RTC-2648: Added arguments for allowing multi instance and custom data dir

This commit is contained in:
Daniel Gronberg
2017-10-31 12:50:57 +01:00
parent 8fb57d2375
commit d6aa415312

View File

@@ -65,8 +65,10 @@ const shouldQuit = app.makeSingleInstance((argv) => {
processProtocolAction(argv);
});
// quit if another instance is already running, ignore for dev env
if (!isDevEnv && shouldQuit) {
let allowMultiInstance = getCmdLineArg(process.argv, '--multiInstance', true) != null || !isDevEnv;
// quit if another instance is already running, ignore for dev env or if app was started with multiInstance flag
if (!allowMultiInstance && shouldQuit) {
app.quit();
}
@@ -140,6 +142,13 @@ function setupThenOpenMainWindow() {
// allows installer to launch app and set appropriate global / user config params.
let hasInstallFlag = getCmdLineArg(process.argv, '--install', true);
let perUserInstall = getCmdLineArg(process.argv, '--peruser', true);
let customDataArg = getCmdLineArg(process.argv, '--userDataPath=', false);
if (customDataArg && customDataArg.split('=').length > 1) {
let customDataFolder = customDataArg.split('=')[1];
console.log('Setting user data dir to ' + customDataFolder);
app.setPath('userData', customDataFolder);
}
if (!isMac && hasInstallFlag) {
getConfigField('launchOnStartup')
.then(setStartup)