diff options
| -rw-r--r-- | app/main.js | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/app/main.js b/app/main.js index 5ffb7b10c5..9c4d66f0d7 100644 --- a/app/main.js +++ b/app/main.js @@ -75,31 +75,13 @@ const appDelegate = { case 'darwin': // macOS: ~/Library/Logs/{appname} return path.join(app.getPath('home'), 'Library/Logs', appDirectoryName); - case 'win32': - // Windows: %ALLUSERSPROFILE%\{appname} - return appDelegate._getSharedDataDirectory(); default: + // Windows: %APPDATA%\{appname}\logs // Linux: ~/.config/{appname}/logs return path.join(app.getPath('userData'), 'logs'); } }, - _getSharedDataDirectory: () => { - switch(process.platform) { - case 'win32': { - // Windows: %ALLUSERSPROFILE%\{appname} - let programDataDirectory = process.env.ALLUSERSPROFILE; - if (typeof programDataDirectory === 'undefined' || programDataDirectory === null) { - throw new Error('Missing %ALLUSERSPROFILE% environment variable'); - } else { - return path.join(programDataDirectory, appDirectoryName); - } - } - default: - throw new Error(`No shared data directory on platform: ${process.platform}`); - } - }, - onTunnelShutdown: (isTunnelDown: boolean) => { appDelegate._readyToQuit = isTunnelDown; app.quit(); @@ -177,8 +159,16 @@ const appDelegate = { const rpcAddressFileName = '.mullvad_rpc_address'; switch(process.platform) { - case 'win32': - return path.join(appDelegate._getSharedDataDirectory(), rpcAddressFileName); + case 'win32': { + // Windows: %ALLUSERSPROFILE%\{appname} + let programDataDirectory = process.env.ALLUSERSPROFILE; + if (typeof programDataDirectory === 'undefined' || programDataDirectory === null) { + throw new Error('Missing %ALLUSERSPROFILE% environment variable'); + } else { + let appDataDirectory = path.join(programDataDirectory, appDirectoryName); + return path.join(appDataDirectory, rpcAddressFileName); + } + } default: return path.join(getSystemTemporaryDirectory(), rpcAddressFileName); } |
