1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Set correct paths to binary in manifest for npm run

This commit is contained in:
Hinton
2020-10-21 20:40:24 +02:00
parent 77fc0ce55b
commit 470df8f589
3 changed files with 138 additions and 96 deletions

View File

@@ -58,7 +58,7 @@ export class NativeMessagingMain {
const baseJson = {
'name': 'com.8bit.bitwarden',
'description': 'Bitwarden desktop <-> browser bridge',
'path': path.join(this.appPath, 'proxys', this.binaryName()),
'path': this.binaryPath(),
'type': 'stdio',
}
@@ -133,12 +133,25 @@ export class NativeMessagingMain {
fs.writeFile(destination, JSON.stringify(manifest, null, 2)).catch(this.logService.error);
}
private binaryName() {
if (process.platform === 'win32') {
return 'proxy.exe';
private binaryPath() {
const isPackaged = process.mainModule.filename.indexOf('app.asar') !== -1;
if (isPackaged) {
const dir = path.join(this.appPath, '..');
if (process.platform === 'win32') {
return path.join(dir, 'proxy.exe');
}
return path.join(dir, 'proxy');
}
return 'proxy';
if (process.platform === 'win32') {
return path.join(this.appPath, 'proxies', 'app-win.exe');
} else if (process.platform === 'darwin') {
return path.join(this.appPath, 'proxies', 'app-macos.exe');
}
return path.join(this.appPath, 'proxies', 'app-linux.exe');
}
private async createWindowsRegistry(check: string, location: string, jsonFile: string) {