From 7d8edc64f0363ee438e04088fb9a06ed5bffd49a Mon Sep 17 00:00:00 2001 From: dmc Date: Mon, 15 Jan 2024 19:58:04 +0100 Subject: [PATCH] append file flag fix --- lib/system-status.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/system-status.js b/lib/system-status.js index c8103a4..d77ee13 100644 --- a/lib/system-status.js +++ b/lib/system-status.js @@ -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')