From 4b69f1d1047efc64705e08ffbb363643147d7206 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Tue, 29 Oct 2019 15:06:56 -0400 Subject: Revert to 93e718a --- src/config.js | 14 +++++++++++--- src/helpers/portable-helpers.js | 16 ---------------- src/index.js | 14 +++++++++++--- 3 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 src/helpers/portable-helpers.js (limited to 'src') diff --git a/src/config.js b/src/config.js index 33067fc9d..a7389b8bc 100644 --- a/src/config.js +++ b/src/config.js @@ -113,9 +113,17 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -import { portable } from './helpers/portable-helpers'; - -portable(); +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); +} export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); diff --git a/src/helpers/portable-helpers.js b/src/helpers/portable-helpers.js deleted file mode 100644 index 60b7b91f1..000000000 --- a/src/helpers/portable-helpers.js +++ /dev/null @@ -1,16 +0,0 @@ -import { app } from 'electron'; -import path from 'path'; - -// Set app directory before loading user modules -export function portable() { - if (process.env.FERDI_APPDATA_DIR != null) { - app.setPath('appData', process.env.FERDI_APPDATA_DIR); - app.setPath('userData', path.join(app.getPath('appData'))); - } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { - app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); - app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); - } else if (process.platform === 'win32') { - app.setPath('appData', process.env.APPDATA); - app.setPath('userData', path.join(app.getPath('appData'), app.getName())); - } -} diff --git a/src/index.js b/src/index.js index 8d52e5396..3453b46f7 100644 --- a/src/index.js +++ b/src/index.js @@ -9,9 +9,17 @@ import fs from 'fs-extra'; import path from 'path'; import windowStateKeeper from 'electron-window-state'; -import { portable } from './helpers/portable-helpers'; - -portable(); +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); +} if (isDevMode) { app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`)); -- cgit v1.2.3-70-g09d2