#1590 Improve single-instance start-up logic, remove duplicate code.
This commit is contained in:
@@ -34,12 +34,6 @@ if (process.platform === 'win32') {
|
|||||||
const squirrelWin32 = require('./squirrel-win32')
|
const squirrelWin32 = require('./squirrel-win32')
|
||||||
shouldQuit = squirrelWin32.handleEvent(argv[0])
|
shouldQuit = squirrelWin32.handleEvent(argv[0])
|
||||||
argv = argv.filter((arg) => !arg.includes('--squirrel'))
|
argv = argv.filter((arg) => !arg.includes('--squirrel'))
|
||||||
|
|
||||||
if (shouldQuit) {
|
|
||||||
app.quit()
|
|
||||||
} else {
|
|
||||||
app.on('second-instance', (event, commandLine) => onAppOpen(commandLine))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldQuit && !config.IS_PORTABLE) {
|
if (!shouldQuit && !config.IS_PORTABLE) {
|
||||||
@@ -55,14 +49,11 @@ if (!shouldQuit && !config.IS_PORTABLE) {
|
|||||||
if (shouldQuit) {
|
if (shouldQuit) {
|
||||||
app.quit()
|
app.quit()
|
||||||
} else {
|
} else {
|
||||||
app.on('second-instance', (event, commandLine, workingDirectory) => onAppOpen(commandLine))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!shouldQuit) {
|
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
|
app.on('second-instance', (event, commandLine, workingDirectory) => onAppOpen(commandLine))
|
||||||
if (config.IS_PORTABLE) {
|
if (config.IS_PORTABLE) {
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
// Put all user data into the "Portable Settings" folder
|
// Put all user data into the "Portable Settings" folder
|
||||||
|
|||||||
Reference in New Issue
Block a user