Simplify logic for resolving path to exe for native messaging (#814)
This commit is contained in:
parent
fa8b368b99
commit
b5492e9546
|
@ -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() {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue