1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-24 11:55:50 +01:00

Simplify logic for resolving path to exe for native messaging (#814)

This commit is contained in:
Oscar Hinton 2021-03-25 23:11:31 +01:00 committed by GitHub
parent fa8b368b99
commit b5492e9546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -119,7 +119,7 @@ export class Main {
this.biometricMain = new BiometricDarwinMain(this.storageService, this.i18nService); this.biometricMain = new BiometricDarwinMain(this.storageService, this.i18nService);
} }
this.nativeMessagingMain = new NativeMessagingMain(this.logService, this.windowMain, app.getPath('userData'), app.getAppPath()); this.nativeMessagingMain = new NativeMessagingMain(this.logService, this.windowMain, app.getPath('userData'), app.getPath('exe'));
} }
bootstrap() { bootstrap() {

View File

@ -12,7 +12,7 @@ export class NativeMessagingMain {
private connected = false; private connected = false;
private socket: any; private socket: any;
constructor(private logService: LogService, private windowMain: WindowMain, private userPath: string, private appPath: string) {} constructor(private logService: LogService, private windowMain: WindowMain, private userPath: string, private exePath: string) {}
async listen() { async listen() {
ipc.config.id = 'bitwarden'; ipc.config.id = 'bitwarden';
@ -182,14 +182,11 @@ export class NativeMessagingMain {
} }
private binaryPath() { private binaryPath() {
const dir = path.join(this.appPath, '..');
if (process.platform === 'win32') { if (process.platform === 'win32') {
return path.join(dir, 'native-messaging.bat'); return path.join(path.basename(this.exePath), 'resources', 'native-messaging.bat');
} else if (process.platform === 'darwin') {
return '/Applications/Bitwarden.app/Contents/MacOS/Bitwarden';
} }
return path.join(dir, '..', 'bitwarden'); return this.exePath;
} }
private async createWindowsRegistry(check: string, location: string, jsonFile: string) { private async createWindowsRegistry(check: string, location: string, jsonFile: string) {