diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-27 13:38:53 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-07-31 09:45:24 -0300 |
| commit | 6cf4fe2377ce1b77ce4035d250a30d5f3facc88f (patch) | |
| tree | e89c78b60bf1944a7ede15949b858c852531c57b /app | |
| parent | 1ea19a8f216443d717c40ba1ff0713bcafe486ea (diff) | |
| download | mullvadvpn-6cf4fe2377ce1b77ce4035d250a30d5f3facc88f.tar.xz mullvadvpn-6cf4fe2377ce1b77ce4035d250a30d5f3facc88f.zip | |
Configure electron to not use roaming directory
Diffstat (limited to 'app')
| -rw-r--r-- | app/main.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/main.js b/app/main.js index 31880248ae..5b242a644c 100644 --- a/app/main.js +++ b/app/main.js @@ -26,6 +26,7 @@ const ApplicationMain = { return; } + this._overrideAppPaths(); this._initLogging(); log.info(`Running version ${app.getVersion()}`); @@ -53,6 +54,20 @@ const ApplicationMain = { return shouldQuit; }, + _overrideAppPaths() { + // This ensures that on Windows the %LOCALAPPDATA% directory is used instead of the %ADDDATA% + // directory that has roaming contents + if (process.platform == 'win32') { + const appDataDir = process.env.LOCALAPPDATA; + if (appDataDir) { + app.setPath('appData', appDataDir); + app.setPath('userData', path.join(appDataDir, app.getName())); + } else { + throw new Error('Missing %LOCALAPPDATA% environment variable'); + } + } + }, + _initLogging() { const logDirectory = this._getLogsDirectory(); const format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}][{level}] {text}'; @@ -98,7 +113,7 @@ const ApplicationMain = { // macOS: ~/Library/Logs/{appname} return path.join(app.getPath('home'), 'Library/Logs', app.getName()); default: - // Windows: %APPDATA%\{appname}\logs + // Windows: %LOCALAPPDATA%\{appname}\logs // Linux: ~/.config/{appname}/logs return path.join(app.getPath('userData'), 'logs'); } |
