diff options
| -rw-r--r-- | app/lib/rpc-address-file.js | 11 | ||||
| -rw-r--r-- | app/main.js | 10 | ||||
| -rw-r--r-- | package.json | 1 |
3 files changed, 7 insertions, 15 deletions
diff --git a/app/lib/rpc-address-file.js b/app/lib/rpc-address-file.js index 6eec716591..6ff920b8df 100644 --- a/app/lib/rpc-address-file.js +++ b/app/lib/rpc-address-file.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; +import { app } from 'electron'; import { promisify } from 'util'; import { getSystemTemporaryDirectory } from './tempdir'; @@ -9,22 +10,16 @@ const fsReadFileAsync = promisify(fs.readFile); const POLL_INTERVAL = 200; -const appDirectoryName = 'Mullvad VPN'; - export type RpcCredentials = { connectionString: string, sharedSecret: string, }; export class RpcAddressFile { - _filePath: string; + _filePath = getRpcAddressFilePath(); _pollIntervalId: ?IntervalID; _pollPromise: ?Promise<void>; - constructor() { - this._filePath = getRpcAddressFilePath(); - } - get filePath(): string { return this._filePath; } @@ -88,7 +83,7 @@ function getRpcAddressFilePath() { // Windows: %ALLUSERSPROFILE%\{appname} const programDataDirectory = process.env.ALLUSERSPROFILE; if (programDataDirectory) { - const appDataDirectory = path.join(programDataDirectory, appDirectoryName); + const appDataDirectory = path.join(programDataDirectory, app.getName()); return path.join(appDataDirectory, rpcAddressFileName); } else { throw new Error('Missing %ALLUSERSPROFILE% environment variable'); diff --git a/app/main.js b/app/main.js index 965d8b8eb3..1cbf72a1b9 100644 --- a/app/main.js +++ b/app/main.js @@ -14,10 +14,6 @@ import uuid from 'uuid'; import { ShutdownCoordinator } from './shutdown-handler'; import type { TrayIconType } from './tray-icon-controller'; -// The name for application directory used for -// scoping logs and user data in platform special folders -const appDirectoryName = 'Mullvad VPN'; - const ApplicationMain = { _windowController: (null: ?WindowController), _trayIconController: (null: ?TrayIconController), @@ -30,8 +26,6 @@ const ApplicationMain = { return; } - // Override userData path, i.e on macOS: ~/Library/Application Support/Mullvad VPN - app.setPath('userData', path.join(app.getPath('appData'), appDirectoryName)); this._initLogging(); log.info('Running version', version); @@ -78,6 +72,8 @@ const ApplicationMain = { log.transports.file.file = this._logFilePath; } + log.debug(`Logging to ${this._logFilePath}`); + // create log folder mkdirp.sync(logDirectory); }, @@ -90,7 +86,7 @@ const ApplicationMain = { switch (process.platform) { case 'darwin': // macOS: ~/Library/Logs/{appname} - return path.join(app.getPath('home'), 'Library/Logs', appDirectoryName); + return path.join(app.getPath('home'), 'Library/Logs', app.getName()); default: // Windows: %APPDATA%\{appname}\logs // Linux: ~/.config/{appname}/logs diff --git a/package.json b/package.json index bfee131c70..e8ede62cc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "mullvad-vpn", "version": "2018.2.0-beta1", + "productName": "Mullvad VPN", "description": "Mullvad VPN client", "main": "init.js", "author": { |
