diff options
author | 2019-10-29 20:52:52 +0100 | |
---|---|---|
committer | 2019-10-29 20:52:52 +0100 | |
commit | 12fdb01d9c4c06c601b7cf62b1b2f170a0ca65c2 (patch) | |
tree | 3d03e94559724ec47f8c7e76accbbfd1abb80813 /src/config.js | |
parent | Merge pull request #161 from Makazzz/readme (diff) | |
parent | Revert to 93e718a (diff) | |
download | ferdium-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
Diffstat (limited to 'src/config.js')
-rw-r--r-- | src/config.js | 12 |
1 files changed, 12 insertions, 0 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 = [ | |||
114 | export const LOCAL_SERVER = 'You are using Ferdi without a server'; | 114 | export const LOCAL_SERVER = 'You are using Ferdi without a server'; |
115 | export const SERVER_NOT_LOADED = 'Ferdi::SERVER_NOT_LOADED'; | 115 | export const SERVER_NOT_LOADED = 'Ferdi::SERVER_NOT_LOADED'; |
116 | 116 | ||
117 | // Set app directory before loading user modules | ||
118 | if (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 | |||
117 | export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); | 129 | export 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 |