From 478475f96436ac7a7c8fbf7cf6a1f7b7ace4fd82 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Sat, 26 Oct 2019 13:27:16 -0400 Subject: Change appData env --- src/config.js | 3 ++- src/index.js | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/config.js b/src/config.js index 761d26eea..ad4fc6165 100644 --- a/src/config.js +++ b/src/config.js @@ -113,7 +113,8 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); +// export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); +export const SETTINGS_PATH = path.join(app.getPath('appData'), 'config'); // Replacing app.asar is not beautiful but unforunately necessary export const RECIPES_PATH = asarPath(path.join(__dirname, 'recipes')); diff --git a/src/index.js b/src/index.js index 87aa6357b..edcea2049 100644 --- a/src/index.js +++ b/src/index.js @@ -9,9 +9,11 @@ import fs from 'fs-extra'; import path from 'path'; import windowStateKeeper from 'electron-window-state'; -if (process.platform === 'win32') { - app.setPath('appData', process.env.LOCALAPPDATA); - app.setPath('userData', path.join(process.env.LOCALAPPDATA, app.getName())); +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}-appdata`); } if (isDevMode) { -- cgit v1.2.3-70-g09d2