diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-01-20 11:43:57 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-01-25 09:51:28 +0100 |
| commit | 15add23d73f267f596f49516bfb73f3f70587930 (patch) | |
| tree | 042a0f0aff31e68458f3fd45c6a5f48bafc835db /gui/src | |
| parent | 450fcef30591d3e77253b583c34d67117b0e77c0 (diff) | |
| download | mullvadvpn-15add23d73f267f596f49516bfb73f3f70587930.tar.xz mullvadvpn-15add23d73f267f596f49516bfb73f3f70587930.zip | |
Explain Electron lock file fix
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/index.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 294bddc494..f6567e47ad 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -338,17 +338,22 @@ class ApplicationMain { if (process.platform === 'win32') { const appDataDir = process.env.LOCALAPPDATA; if (appDataDir) { - const userData = path.join(appDataDir, app.name); + const userDataDir = path.join(appDataDir, app.name); + const logDir = path.join(userDataDir, 'logs'); + // In Electron 16, the `appData` directory must be created explicitly or an error is + // thrown when creating the singleton lock file. + fs.mkdirSync(logDir, { recursive: true }); app.setPath('appData', appDataDir); - app.setPath('userData', userData); - app.setPath('logs', path.join(appDataDir, app.name, 'logs')); - fs.mkdirSync(userData, { recursive: true }); + app.setPath('userData', userDataDir); + app.setPath('logs', logDir); } else { throw new Error('Missing %LOCALAPPDATA% environment variable'); } } else if (process.platform === 'linux') { const userDataDir = app.getPath('userData'); - app.setPath('logs', path.join(userDataDir, 'logs')); + const logDir = path.join(userDataDir, 'logs'); + fs.mkdirSync(logDir, { recursive: true }); + app.setPath('logs', logDir); } } |
