From a71bdb1e29e503e961c12cf1fc8603c08d7231ae Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 25 Jan 2021 18:55:21 +0100 Subject: [PATCH] Fix native-messaging uninstall not removing the files (#681) --- src/main/nativeMessaging.main.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/nativeMessaging.main.ts b/src/main/nativeMessaging.main.ts index 63c4011ed1..8c5470f9ae 100644 --- a/src/main/nativeMessaging.main.ts +++ b/src/main/nativeMessaging.main.ts @@ -115,21 +115,21 @@ export class NativeMessagingMain { this.deleteWindowsRegistry('HKCU\\SOFTWARE\\Google\\Chrome\\NativeMessagingHosts\\com.8bit.bitwarden'); break; case 'darwin': - if (existsSync('~/Library/Application Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json')) { - fs.unlink('~/Library/Application Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json'); + if (existsSync(`${homedir()}/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json`)) { + fs.unlink(`${homedir()}/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json`); } - if (existsSync('~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.8bit.bitwarden.json')) { - fs.unlink('~/Library/Application Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json'); + if (existsSync(`${homedir()}/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.8bit.bitwarden.json`)) { + fs.unlink(`${homedir()}/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.8bit.bitwarden.json`); } break; case 'linux': - if (existsSync('~/.mozilla/native-messaging-hosts/com.8bit.bitwarden.json')) { - fs.unlink('~/.mozilla/native-messaging-hosts/com.8bit.bitwarden.json'); + if (existsSync(`${homedir()}/.mozilla/native-messaging-hosts/com.8bit.bitwarden.json`)) { + fs.unlink(`${homedir()}/.mozilla/native-messaging-hosts/com.8bit.bitwarden.json`); } - if (existsSync('~/.config/google-chrome/NativeMessagingHosts/com.8bit.bitwarden.json')) { - fs.unlink('~/.config/google-chrome/NativeMessagingHosts/com.8bit.bitwarden.json'); + if (existsSync(`${homedir()}/.config/google-chrome/NativeMessagingHosts/com.8bit.bitwarden.json`)) { + fs.unlink(`${homedir()}/.config/google-chrome/NativeMessagingHosts/com.8bit.bitwarden.json`); } break; default: