aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2019-10-29 20:52:52 +0100
committerLibravatar GitHub <noreply@github.com>2019-10-29 20:52:52 +0100
commit12fdb01d9c4c06c601b7cf62b1b2f170a0ca65c2 (patch)
tree3d03e94559724ec47f8c7e76accbbfd1abb80813
parentMerge pull request #161 from Makazzz/readme (diff)
parentRevert to 93e718a (diff)
downloadferdium-app-12fdb01d9c4c06c601b7cf62b1b2f170a0ca65c2.tar.gz
ferdium-app-12fdb01d9c4c06c601b7cf62b1b2f170a0ca65c2.tar.zst
ferdium-app-12fdb01d9c4c06c601b7cf62b1b2f170a0ca65c2.zip
Merge pull request #167 from Makazzz/portable-env
#87 Portable Directory working
-rw-r--r--src/config.js12
-rw-r--r--src/index.js13
2 files changed, 22 insertions, 3 deletions
diff --git a/src/config.js b/src/config.js
index 1db881d35..bd67aee6b 100644
--- a/src/config.js
+++ b/src/config.js
@@ -114,6 +114,18 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [
114export const LOCAL_SERVER = 'You are using Ferdi without a server'; 114export const LOCAL_SERVER = 'You are using Ferdi without a server';
115export const SERVER_NOT_LOADED = 'Ferdi::SERVER_NOT_LOADED'; 115export const SERVER_NOT_LOADED = 'Ferdi::SERVER_NOT_LOADED';
116 116
117// Set app directory before loading user modules
118if (process.env.FERDI_APPDATA_DIR != null) {
119 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
120 app.setPath('userData', path.join(app.getPath('appData')));
121} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) {
122 app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`);
123 app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`));
124} else if (process.platform === 'win32') {
125 app.setPath('appData', process.env.APPDATA);
126 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
127}
128
117export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); 129export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config');
118 130
119// Replacing app.asar is not beautiful but unforunately necessary 131// Replacing app.asar is not beautiful but unforunately necessary
diff --git a/src/index.js b/src/index.js
index 87aa6357b..3453b46f7 100644
--- a/src/index.js
+++ b/src/index.js
@@ -9,9 +9,16 @@ 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
12if (process.platform === 'win32') { 12// Set app directory before loading user modules
13 app.setPath('appData', process.env.LOCALAPPDATA); 13if (process.env.FERDI_APPDATA_DIR != null) {
14 app.setPath('userData', path.join(process.env.LOCALAPPDATA, app.getName())); 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()));
15} 22}
16 23
17if (isDevMode) { 24if (isDevMode) {