summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-31 10:23:01 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-07-31 10:23:01 -0300
commitaca43fd96c1d1937d2304d9602b84b24fe339b9b (patch)
treed5eea6f0d5035f7e4baf9fbde603abf30dd27869
parentc725e5bcddc975d5cc197fbfbe72e52972195748 (diff)
parent923ee5f767d219589cb5904ce07a4d3021124ddd (diff)
downloadmullvadvpn-aca43fd96c1d1937d2304d9602b84b24fe339b9b.tar.xz
mullvadvpn-aca43fd96c1d1937d2304d9602b84b24fe339b9b.zip
Merge branch 'dont-use-roaming-path'
-rw-r--r--CHANGELOG.md4
-rw-r--r--README.md8
-rw-r--r--app/main.js29
-rw-r--r--mullvad-paths/src/settings.rs2
4 files changed, 32 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3880fa8a6d..aed8b5b68f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,10 @@ Line wrap the file at 100 chars. Th
- Format the expiry date and time using the system locale.
- Account tokens are now required to have at least ten digits.
+#### Windows
+- Use local user directory to store settings and electron cache, instead of the roaming user
+ directory.
+
### Fixed
- Ignore empty strings as redaction requests in the problem report tool, to avoid adding redacted
markers between every character of the log message.
diff --git a/README.md b/README.md
index bc24134909..916727c112 100644
--- a/README.md
+++ b/README.md
@@ -267,8 +267,8 @@ A list of file paths written to and read from by the various components of the M
### Daemon
-On Windows, when a process runs as a system service the variable `%APPDATA%` expands to
-`C:\Windows\system32\config\systemprofile\AppData\Roaming`.
+On Windows, when a process runs as a system service the variable `%LOCALAPPDATA%` expands to
+`C:\Windows\system32\config\systemprofile\AppData\Local`.
All directory paths are defined in, and fetched from, the `mullvad-paths` crate.
@@ -280,7 +280,7 @@ The settings directory can be changed by setting the `MULLVAD_SETTINGS_DIR` envi
|----------|------|
| Linux | `/etc/mullvad-daemon/settings.json` |
| macOS | `/etc/mullvad-daemon/settings.json` |
-| Windows | `%APPDATA%\Mullvad\Mullvad VPN\settings.json`
+| Windows | `%LOCALAPPDATA%\Mullvad\Mullvad VPN\settings.json`
#### Logs
@@ -300,7 +300,7 @@ The cache directory can be changed by setting the `MULLVAD_CACHE_DIR` environmen
|----------|------|
| Linux | `/var/cache/mullvad-daemon/` |
| macOS | `/var/root/Library/Caches/mullvad-daemon/` |
-| Windows | `%APPDATA%\Local\Mullvad\Mullvad VPN\` |
+| Windows | `%LOCALAPPDATA%\Mullvad\Mullvad VPN\` |
#### RPC address file
diff --git a/app/main.js b/app/main.js
index 6e1e0bbbbc..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}';
@@ -67,6 +82,10 @@ const ApplicationMain = {
// Disable log file in development
log.transports.file.level = false;
} else {
+ // Create log folder
+ mkdirp.sync(logDirectory);
+
+ // Backup previous log file if it exists
try {
fs.accessSync(this._logFilePath);
this._oldLogFilePath = path.join(logDirectory, 'frontend.old.log');
@@ -75,15 +94,13 @@ const ApplicationMain = {
// No previous log file exists
}
+ // Configure logging to file
log.transports.console.level = 'debug';
log.transports.file.level = 'debug';
log.transports.file.file = this._logFilePath;
- }
- log.debug(`Logging to ${this._logFilePath}`);
-
- // create log folder
- mkdirp.sync(logDirectory);
+ log.debug(`Logging to ${this._logFilePath}`);
+ }
},
// Returns platform specific logs folder for application
@@ -96,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');
}
diff --git a/mullvad-paths/src/settings.rs b/mullvad-paths/src/settings.rs
index a7c879e32d..80c0c73947 100644
--- a/mullvad-paths/src/settings.rs
+++ b/mullvad-paths/src/settings.rs
@@ -27,7 +27,7 @@ fn get_default_settings_dir() -> Result<PathBuf> {
#[cfg(windows)]
fn get_default_settings_dir() -> Result<PathBuf> {
Ok(::app_dirs::get_app_root(
- ::app_dirs::AppDataType::UserConfig,
+ ::app_dirs::AppDataType::UserData,
&::metadata::APP_INFO,
)?)
}