From 478475f96436ac7a7c8fbf7cf6a1f7b7ace4fd82 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Sat, 26 Oct 2019 13:27:16 -0400 Subject: Change appData env --- src/config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/config.js') diff --git a/src/config.js b/src/config.js index 761d26eea..ad4fc6165 100644 --- a/src/config.js +++ b/src/config.js @@ -113,7 +113,8 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); +// export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); +export const SETTINGS_PATH = path.join(app.getPath('appData'), 'config'); // Replacing app.asar is not beautiful but unforunately necessary export const RECIPES_PATH = asarPath(path.join(__dirname, 'recipes')); -- cgit v1.2.3-54-g00ecf From bc21d533bd2c1b9f4bdfb8553b4a3f21d1b845e1 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Sat, 26 Oct 2019 15:24:16 -0400 Subject: Testing --- src/config.js | 3 +-- src/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/config.js') diff --git a/src/config.js b/src/config.js index ad4fc6165..761d26eea 100644 --- a/src/config.js +++ b/src/config.js @@ -113,8 +113,7 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -// export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); -export const SETTINGS_PATH = path.join(app.getPath('appData'), 'config'); +export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); // Replacing app.asar is not beautiful but unforunately necessary export const RECIPES_PATH = asarPath(path.join(__dirname, 'recipes')); diff --git a/src/index.js b/src/index.js index edcea2049..fd96f8a49 100644 --- a/src/index.js +++ b/src/index.js @@ -10,10 +10,10 @@ import path from 'path'; import windowStateKeeper from 'electron-window-state'; // Set app directory before loading user modules -if (process.env.FERDI_APPDATA_DIR != null) { - app.setPath('appData', process.env.FERDI_APPDATA_DIR); -} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { - app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}-appdata`); +if (process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR) { + const appDataPath = process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR + app.setPath('appData', appDataPath); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); } if (isDevMode) { -- cgit v1.2.3-54-g00ecf From 93e718a148588b7cc56f1e3e3183ca1000c13137 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Sun, 27 Oct 2019 17:28:42 -0400 Subject: Add portable dir --- src/config.js | 12 ++++++++++++ src/index.js | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/config.js') 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 = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); +} + export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); // 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'; import windowStateKeeper from 'electron-window-state'; // Set app directory before loading user modules -if (process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR) { - const appDataPath = process.env.FERDI_APPDATA_DIR || process.env.PORTABLE_EXECUTABLE_DIR - app.setPath('appData', appDataPath); +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); app.setPath('userData', path.join(app.getPath('appData'), app.getName())); } -- cgit v1.2.3-54-g00ecf From 62f30ccd4c430213860da36d52de793cfcfd293a Mon Sep 17 00:00:00 2001 From: Makazzz Date: Tue, 29 Oct 2019 14:45:00 -0400 Subject: Creating function instead --- src/config.js | 14 +++----------- src/helpers/portable-helpers.js | 16 ++++++++++++++++ src/index.js | 14 +++----------- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 src/helpers/portable-helpers.js (limited to 'src/config.js') diff --git a/src/config.js b/src/config.js index a7389b8bc..33067fc9d 100644 --- a/src/config.js +++ b/src/config.js @@ -113,17 +113,9 @@ export const FILE_SYSTEM_SETTINGS_TYPES = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -// Set app directory before loading user modules -if (process.env.FERDI_APPDATA_DIR != null) { - app.setPath('appData', process.env.FERDI_APPDATA_DIR); - app.setPath('userData', path.join(app.getPath('appData'))); -} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { - app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); - app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); -} else if (process.platform === 'win32') { - app.setPath('appData', process.env.APPDATA); - app.setPath('userData', path.join(app.getPath('appData'), app.getName())); -} +import { portable } from './helpers/portable-helpers'; + +portable(); export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); diff --git a/src/helpers/portable-helpers.js b/src/helpers/portable-helpers.js new file mode 100644 index 000000000..60b7b91f1 --- /dev/null +++ b/src/helpers/portable-helpers.js @@ -0,0 +1,16 @@ +import { app } from 'electron'; +import path from 'path'; + +// Set app directory before loading user modules +export function portable() { + if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); + } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); + } else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); + } +} diff --git a/src/index.js b/src/index.js index 3453b46f7..8d52e5396 100644 --- a/src/index.js +++ b/src/index.js @@ -9,17 +9,9 @@ import fs from 'fs-extra'; import path from 'path'; import windowStateKeeper from 'electron-window-state'; -// Set app directory before loading user modules -if (process.env.FERDI_APPDATA_DIR != null) { - app.setPath('appData', process.env.FERDI_APPDATA_DIR); - app.setPath('userData', path.join(app.getPath('appData'))); -} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { - app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); - app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); -} else if (process.platform === 'win32') { - app.setPath('appData', process.env.APPDATA); - app.setPath('userData', path.join(app.getPath('appData'), app.getName())); -} +import { portable } from './helpers/portable-helpers'; + +portable(); if (isDevMode) { app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`)); -- cgit v1.2.3-54-g00ecf From 4b69f1d1047efc64705e08ffbb363643147d7206 Mon Sep 17 00:00:00 2001 From: Makazzz Date: Tue, 29 Oct 2019 15:06:56 -0400 Subject: Revert to 93e718a --- src/config.js | 14 +++++++++++--- src/helpers/portable-helpers.js | 16 ---------------- src/index.js | 14 +++++++++++--- 3 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 src/helpers/portable-helpers.js (limited to 'src/config.js') 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 = [ export const LOCAL_SERVER = 'You are using Ferdi without a server'; -import { portable } from './helpers/portable-helpers'; - -portable(); +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); +} export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config'); 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 @@ -import { app } from 'electron'; -import path from 'path'; - -// Set app directory before loading user modules -export function portable() { - if (process.env.FERDI_APPDATA_DIR != null) { - app.setPath('appData', process.env.FERDI_APPDATA_DIR); - app.setPath('userData', path.join(app.getPath('appData'))); - } else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { - app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); - app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); - } else if (process.platform === 'win32') { - app.setPath('appData', process.env.APPDATA); - app.setPath('userData', path.join(app.getPath('appData'), app.getName())); - } -} 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'; import path from 'path'; import windowStateKeeper from 'electron-window-state'; -import { portable } from './helpers/portable-helpers'; - -portable(); +// Set app directory before loading user modules +if (process.env.FERDI_APPDATA_DIR != null) { + app.setPath('appData', process.env.FERDI_APPDATA_DIR); + app.setPath('userData', path.join(app.getPath('appData'))); +} else if (process.env.PORTABLE_EXECUTABLE_DIR != null) { + app.setPath('appData', process.env.PORTABLE_EXECUTABLE_DIR, `${app.getName()}AppData`); + app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}AppData`)); +} else if (process.platform === 'win32') { + app.setPath('appData', process.env.APPDATA); + app.setPath('userData', path.join(app.getPath('appData'), app.getName())); +} if (isDevMode) { app.setPath('userData', path.join(app.getPath('appData'), `${app.getName()}Dev`)); -- cgit v1.2.3-54-g00ecf