mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
append file flag fix
This commit is contained in:
@@ -105,7 +105,6 @@ customElements.define('system-status', class extends HTMLElement {
|
||||
this.shellProfiles[file] = { filepath, hasPear: this.stmtrx.test(contents) }
|
||||
hasPear = hasPear || this.shellProfiles[file].hasPear
|
||||
}
|
||||
console.log('hi', contents, hasPear, this.stmtrx, this.shellProfiles[file])
|
||||
}
|
||||
if (hasPear) process.env.PATH = `${BIN}:${process.env.PATH}`
|
||||
}
|
||||
@@ -151,13 +150,13 @@ customElements.define('system-status', class extends HTMLElement {
|
||||
const profiles = Object.values(this.shellProfiles)
|
||||
if (profiles.length > 0) {
|
||||
for (const { filepath, hasPear } of profiles) {
|
||||
if (hasPear === false) fs.writeFileSync(filepath, this.statement, { flags: 'a' })
|
||||
if (hasPear === false) fs.writeFileSync(filepath, this.statement, { flag: 'a' })
|
||||
}
|
||||
} else {
|
||||
const bash = this.paths.some((bin) => fs.existsSync(path.join(bin, 'bash')))
|
||||
const zsh = this.paths.some((bin) => fs.existsSync(path.join(bin, 'zsh')))
|
||||
fs.writeFileSync(path.join(os.homedir(), bash ? '.bashrc' : '.profile'), this.statement + '\n', { flags: 'a' })
|
||||
if (zsh) fs.writeFileSync(path.join(os.homedir(), '.zshrc'), this.statement + '\n', { flags: 'a' })
|
||||
fs.writeFileSync(path.join(os.homedir(), bash ? '.bashrc' : '.profile'), this.statement + '\n', { flag: 'a' })
|
||||
if (zsh) fs.writeFileSync(path.join(os.homedir(), '.zshrc'), this.statement + '\n', { flag: 'a' })
|
||||
}
|
||||
|
||||
const pear = path.join(BIN, 'pear')
|
||||
|
||||
Reference in New Issue
Block a user