Fix edge case where tmp directory doesn't exist in home dir on mac.
This commit is contained in:
parent
7b9156c041
commit
c2e8e07002
|
@ -14,10 +14,13 @@ export class NativeMessagingMain {
|
|||
|
||||
constructor(private logService: LogService, private windowMain: WindowMain, private userPath: string, private appPath: string) {}
|
||||
|
||||
listen() {
|
||||
async listen() {
|
||||
ipc.config.id = 'bitwarden';
|
||||
ipc.config.retry = 1500;
|
||||
if (process.platform === 'darwin') {
|
||||
if (!existsSync(`${homedir()}/tmp`)) {
|
||||
await fs.mkdir(`${homedir()}/tmp`);
|
||||
}
|
||||
ipc.config.socketRoot = `${homedir()}/tmp/`;
|
||||
}
|
||||
|
||||
|
@ -163,8 +166,10 @@ export class NativeMessagingMain {
|
|||
};
|
||||
}
|
||||
|
||||
private writeManifest(destination: string, manifest: object) {
|
||||
fs.mkdir(path.dirname(destination));
|
||||
private async writeManifest(destination: string, manifest: object) {
|
||||
if (!existsSync(path.dirname(destination))) {
|
||||
await fs.mkdir(path.dirname(destination));
|
||||
}
|
||||
fs.writeFile(destination, JSON.stringify(manifest, null, 2)).catch(this.logService.error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue