File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,27 @@ let launchUrl;
18
18
19
19
let manifestJsonFileName = 'electron.manifest.json' ;
20
20
let watchable = false ;
21
+
22
+ // handle for opening the app with a file for win and linux
23
+ if ( process && process . argv . length > 1 ) {
24
+
25
+ let firstAppArgument = process . argv [ 1 ] ;
26
+
27
+ // With invoked via electronize, the first argument is the path to the main.js.
28
+ // Per issue #337, the /args switch can also be present. If either are present,
29
+ // we need to check the subsequent argument.
30
+ if ( firstAppArgument === '..\\..\\main.js' || firstAppArgument === '../../main.js' || firstAppArgument === '/args' ) {
31
+ if ( process . argv . length > 2 ) {
32
+ firstAppArgument = process . argv [ 2 ] ;
33
+ }
34
+ }
35
+
36
+ // only append the first app arg if it is not already a switch
37
+ if ( ! firstAppArgument . startsWith ( "--" ) ) {
38
+ app . commandLine . appendSwitch ( "open-file" , firstAppArgument ) ;
39
+ }
40
+ }
41
+
21
42
if ( app . commandLine . hasSwitch ( 'manifest' ) ) {
22
43
manifestJsonFileName = app . commandLine . getSwitchValue ( 'manifest' ) ;
23
44
}
You can’t perform that action at this time.
0 commit comments