aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Makazzz <makazzzpro@live.ca>2019-10-27 17:28:42 -0400
committerLibravatar Makazzz <makazzzpro@live.ca>2019-10-27 17:28:42 -0400
commit93e718a148588b7cc56f1e3e3183ca1000c13137 (patch)
tree33a6a3458088949fb5acbc4646414509f62bec44
parentTesting (diff)
downloadferdium-app-93e718a148588b7cc56f1e3e3183ca1000c13137.tar.gz
ferdium-app-93e718a148588b7cc56f1e3e3183ca1000c13137.tar.zst
ferdium-app-93e718a148588b7cc56f1e3e3183ca1000c13137.zip
Add portable dir
-rw-r--r--src/config.js12
-rw-r--r--src/index.js11
2 files changed, 20 insertions, 3 deletions
diff --git a/src/config.js b/src/config.js
index 761d26eea..a7389b8bc 100644
--- a/src/config.js
+++ b/src/config.js
@@ -113,6 +113,18 @@ 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
116// Set app directory before loading user modules
117if (process.env.FERDI_APPDATA_DIR != null) {
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}
127
116export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); 128export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config');
117 129
118// Replacing app.asar is not beautiful but unforunately necessary 130// Replacing app.asar is not beautiful but unforunately necessary
diff --git a/src/index.js b/src/index.js
index fd96f8a49..3453b46f7 100644
--- a/src/index.js
+++ b/src/index.js
@@ -10,9 +10,14 @@ import path from 'path';
10import windowStateKeeper from 'electron-window-state'; 10import windowStateKeeper from 'electron-window-state';
11 11
12// Set app directory before loading user modules 12// Set app directory before loading user modules
13if (process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR) { 13if (process.env.FERDI_APPDATA_DIR != null) {
14 const appDataPath = process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR 14 app.setPath('appData', process.env.FERDI_APPDATA_DIR);
15 app.setPath('appData', appDataPath); 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);
16 app.setPath('userData', path.join(app.getPath('appData'), app.getName())); 21 app.setPath('userData', path.join(app.getPath('appData'), app.getName()));
17} 22}
18 23