aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.js14
-rw-r--r--src/helpers/portable-helpers.js16
-rw-r--r--src/index.js14
3 files changed, 22 insertions, 22 deletions
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 = [
113 113
114export const LOCAL_SERVER = 'You are using Ferdi without a server'; 114export const LOCAL_SERVER = 'You are using Ferdi without a server';
115 115
116import { portable } from './helpers/portable-helpers'; 116// Set app directory before loading user modules
117 117if (process.env.FERDI_APPDATA_DIR != null) {
118portable(); 118 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
119 app.setPath('userData', path.join(app.getPath('appData')));
120} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
121 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`);
122 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`));
123} else if (process.platform === 'win32') {
124 app.setPath('appData', process.env.APPDATA);
125 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
126}
119 127
120export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); 128export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config');
121 129
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 @@
1import { app } from 'electron';
2import path from 'path';
3
4// Set app directory before loading user modules
5export function portable() {
6 if (process.env.FERDI_APPDATA_DIR != null) {
7 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
8 app.setPath('userData', path.join(app.getPath('appData')));
9 } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
10 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`);
11 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`));
12 } else if (process.platform === 'win32') {
13 app.setPath('appData', process.env.APPDATA);
14 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
15 }
16}
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';
9import path from 'path'; 9import path from 'path';
10import windowStateKeeper from 'electron-window-state'; 10import windowStateKeeper from 'electron-window-state';
11 11
12import { portable } from './helpers/portable-helpers'; 12// Set app directory before loading user modules
13 13if (process.env.FERDI_APPDATA_DIR != null) {
14portable(); 14 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
15 app.setPath('userData', path.join(app.getPath('appData')));
16} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
17 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`);
18 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`));
19} else if (process.platform === 'win32') {
20 app.setPath('appData', process.env.APPDATA);
21 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
22}
15 23
16if (isDevMode) { 24if (isDevMode) {
17 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`)); 25 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`));