Merge pull request #224 from danielgronberg/danielgronbergmaster

RTC-2648: Added arguments for allowing multi instance and custom data dir
This commit is contained in:
Vikas Shashidhar
2017-11-07 15:12:48 +05:30
committed by GitHub
2 changed files with 13 additions and 3 deletions

View File

@@ -66,8 +66,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) || 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();
}
@@ -155,6 +157,12 @@ 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];
app.setPath('userData', customDataFolder);
}
if (!isMac && hasInstallFlag) {
getConfigField('launchOnStartup')
.then(setStartup)