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:
@@ -2,13 +2,14 @@ var electron = require('electron')
|
||||
|
||||
var app = electron.app
|
||||
|
||||
var config = require('../config')
|
||||
var ipc = require('./ipc')
|
||||
var menu = require('./menu')
|
||||
var registerProtocolHandler = require('./register-protocol-handler')
|
||||
var shortcuts = require('./shortcuts')
|
||||
var windows = require('./windows')
|
||||
var registerProtocolHandler = require('./register-protocol-handler')
|
||||
|
||||
var argv = process.argv.slice(2)
|
||||
var argv = process.argv.slice(config.IS_PRODUCTION ? 1 : 2)
|
||||
|
||||
app.on('open-file', onOpen)
|
||||
app.on('open-url', onOpen)
|
||||
@@ -24,8 +25,9 @@ app.on('ready', function () {
|
||||
})
|
||||
|
||||
app.on('ipcReady', function () {
|
||||
windows.main.send('log', 'IS_PRODUCTION:', config.IS_PRODUCTION)
|
||||
if (argv.length) {
|
||||
windows.main.send('log', 'command line args:', argv)
|
||||
windows.main.send('log', 'command line args:', process.argv)
|
||||
}
|
||||
argv.forEach(function (torrentId) {
|
||||
windows.main.send('dispatch', 'onOpen', torrentId)
|
||||
|
||||
Reference in New Issue
Block a user