detect if app is running in production
If app is running in “production” (i.e. it has been packaged), then it will be invoked with one less argument. WebTorrent.exe arguments vs. electron.exe /path/to/app arguments We need to detect this to correctly handle command line arguments.
This commit is contained in:
14
config.js
14
config.js
@@ -10,6 +10,8 @@ module.exports = {
|
||||
|
||||
INDEX: 'file://' + path.join(__dirname, 'renderer', 'index.html'),
|
||||
|
||||
IS_PRODUCTION: isProduction(),
|
||||
|
||||
SOUND_ADD: 'file://' + path.join(__dirname, 'static', 'sound', 'add.wav'),
|
||||
SOUND_DELETE: 'file://' + path.join(__dirname, 'static', 'sound', 'delete.wav'),
|
||||
SOUND_DISABLE: 'file://' + path.join(__dirname, 'static', 'sound', 'disable.wav'),
|
||||
@@ -19,3 +21,15 @@ module.exports = {
|
||||
SOUND_PLAY: 'file://' + path.join(__dirname, 'static', 'sound', 'play.wav'),
|
||||
SOUND_STARTUP: 'file://' + path.join(__dirname, 'static', 'sound', 'startup.wav')
|
||||
}
|
||||
|
||||
function isProduction () {
|
||||
if (process.platform === 'darwin') {
|
||||
return !/\/Electron\.app\/Contents\/MacOS\/Electron$/.test(process.execPath)
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
return !/\\electron\.exe$/.test(process.execPath)
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user