diff options
author | 2019-10-29 21:18:24 +0100 | |
---|---|---|
committer | 2019-10-29 21:18:24 +0100 | |
commit | 344eada924b196e2743cd016bbbb8cf6f26486f4 (patch) | |
tree | 4a93522741ad843ddc2d72c76005ba161d258685 /src | |
parent | Add @ammarmalhas as a contributor (diff) | |
parent | Merge pull request #167 from Makazzz/portable-env (diff) | |
download | ferdium-app-344eada924b196e2743cd016bbbb8cf6f26486f4.tar.gz ferdium-app-344eada924b196e2743cd016bbbb8cf6f26486f4.tar.zst ferdium-app-344eada924b196e2743cd016bbbb8cf6f26486f4.zip |
Merge branch 'develop' of https://github.com/getferdi/ferdi into develop
Diffstat (limited to 'src')
-rw-r--r-- | src/config.js | 12 | ||||
-rw-r--r-- | src/index.js | 13 |
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 = [ | |||
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 |
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'; | |||
9 | import path from 'path'; | 9 | import path from 'path'; |
10 | import windowStateKeeper from 'electron-window-state'; | 10 | import windowStateKeeper from 'electron-window-state'; |
11 | 11 | ||
12 | if (process.platform === 'win32') { | 12 | // Set app directory before loading user modules |
13 | app.setPath('appData', process.env.LOCALAPPDATA); | 13 | if (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 | ||
17 | if (isDevMode) { | 24 | if (isDevMode) { |