allow user to adjust appdata dir with env variable

This commit is contained in:
Kyle Spearrin 2018-02-20 16:04:35 -05:00
parent 1de1aaa971
commit aa515cb369
1 changed files with 8 additions and 2 deletions

View File

@ -24,8 +24,14 @@ export class Main {
constructor() {
// Set paths for portable builds
if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
const appDataPath = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'bitwarden-appdata');
let appDataPath = null;
if (process.env.BITWARDEN_APPDATA_DIR != null) {
appDataPath = process.env.BITWARDEN_APPDATA_DIR;
} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
appDataPath = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'bitwarden-appdata');
}
if (appDataPath != null) {
app.setPath('userData', appDataPath);
app.setPath('logs', path.join(appDataPath, 'logs'));
}