From aa515cb36945437e826c4a2a70717d8d154bc964 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 20 Feb 2018 16:04:35 -0500 Subject: [PATCH] allow user to adjust appdata dir with env variable --- src/main.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index a22bec39..6ed502ca 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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')); }