Add --data-dir to switch userData directory
This commit is contained in:
@@ -16,7 +16,7 @@ remote.getCurrentWindow().removeAllListeners('focus');
|
||||
|
||||
var config;
|
||||
try {
|
||||
var configFile = remote.getGlobal('config-file');
|
||||
const configFile = remote.app.getPath('userData') + '/config.json';
|
||||
config = settings.readFileSync(configFile);
|
||||
} catch (e) {
|
||||
window.location = 'settings.html';
|
||||
|
@@ -10,7 +10,7 @@ const React = require('react');
|
||||
const ReactDOM = require('react-dom');
|
||||
const SettingsPage = require('./components/SettingsPage.jsx');
|
||||
|
||||
var configFile = remote.getGlobal('config-file');
|
||||
const configFile = remote.app.getPath('userData') + '/config.json';
|
||||
|
||||
require('electron-context-menu')({
|
||||
window: remote.getCurrentWindow()
|
||||
|
11
src/main.js
11
src/main.js
@@ -90,16 +90,13 @@ if (argv.hidden) {
|
||||
hideOnStartup = true;
|
||||
}
|
||||
|
||||
// TODO: We should document this if that hasn't been done already
|
||||
if (argv['config-file']) {
|
||||
global['config-file'] = argv['config-file'];
|
||||
} else {
|
||||
global['config-file'] = app.getPath('userData') + '/config.json';
|
||||
if (argv['data-dir']) {
|
||||
app.setPath('userData', path.resolve(argv['data-dir']));
|
||||
}
|
||||
|
||||
var config = {};
|
||||
try {
|
||||
const configFile = global['config-file'];
|
||||
const configFile = app.getPath('userData') + '/config.json';
|
||||
config = settings.readFileSync(configFile);
|
||||
if (config.version !== settings.version || wasUpdated()) {
|
||||
clearAppCache();
|
||||
@@ -112,7 +109,7 @@ try {
|
||||
}
|
||||
|
||||
ipcMain.on('update-config', () => {
|
||||
const configFile = global['config-file'];
|
||||
const configFile = app.getPath('userData') + '/config.json';
|
||||
config = settings.readFileSync(configFile);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user