mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
fix #647 process argv for open-file for win and linux
This commit is contained in:
@@ -18,6 +18,27 @@ let launchUrl;
|
||||
|
||||
let manifestJsonFileName = 'electron.manifest.json';
|
||||
let watchable = false;
|
||||
|
||||
// handle for opening the app with a file for win and linux
|
||||
if (process && process.argv.length > 1) {
|
||||
|
||||
let firstAppArgument = process.argv[1];
|
||||
|
||||
// With invoked via electronize, the first argument is the path to the main.js.
|
||||
// Per issue #337, the /args switch can also be present. If either are present,
|
||||
// we need to check the subsequent argument.
|
||||
if (firstAppArgument === '..\\..\\main.js' || firstAppArgument === '../../main.js' || firstAppArgument === '/args') {
|
||||
if (process.argv.length > 2) {
|
||||
firstAppArgument = process.argv[2];
|
||||
}
|
||||
}
|
||||
|
||||
// only append the first app arg if it is not already a switch
|
||||
if (!firstAppArgument.startsWith("--")) {
|
||||
app.commandLine.appendSwitch("open-file", firstAppArgument);
|
||||
}
|
||||
}
|
||||
|
||||
if (app.commandLine.hasSwitch('manifest')) {
|
||||
manifestJsonFileName = app.commandLine.getSwitchValue('manifest');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user