@@ -83,7 +83,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
83
83
return ;
84
84
}
85
85
86
- if ( ! os . isOSX && await this . launchWindowsOpen ( params ) ) {
86
+ if ( ! os . isOSX && await this . launchFromArgs ( params ) ) {
87
87
// Application has received a file in its arguments and will skip the default application launch
88
88
return ;
89
89
}
@@ -105,27 +105,20 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
105
105
}
106
106
}
107
107
108
- protected async launchWindowsOpen ( params : ElectronMainExecutionParams ) : Promise < boolean > {
108
+ protected async launchFromArgs ( params : ElectronMainExecutionParams ) : Promise < boolean > {
109
109
// Copy to prevent manipulation of original array
110
110
const argCopy = [ ...params . argv ] ;
111
- if ( app . isPackaged ) {
112
- // workaround for missing executable argument when app is packaged
113
- argCopy . unshift ( 'packaged' ) ;
114
- }
115
- const possibleUris = argCopy . slice ( 2 ) || null ;
116
- if ( possibleUris ) {
117
- let uri : string | undefined ;
118
- for ( const possibleUri of possibleUris ) {
119
- if ( possibleUri . endsWith ( '.ino' ) && await this . isValidSketchPath ( possibleUri ) ) {
120
- uri = possibleUri ;
121
- break ;
122
- }
123
- }
124
- if ( uri ) {
125
- await this . openSketch ( dirname ( uri ) ) ;
126
- return true ;
111
+ let uri : string | undefined ;
112
+ for ( const possibleUri of argCopy ) {
113
+ if ( possibleUri . endsWith ( '.ino' ) && await this . isValidSketchPath ( possibleUri ) ) {
114
+ uri = possibleUri ;
115
+ break ;
127
116
}
128
117
}
118
+ if ( uri ) {
119
+ await this . openSketch ( dirname ( uri ) ) ;
120
+ return true ;
121
+ }
129
122
return false ;
130
123
}
131
124
@@ -170,7 +163,7 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
170
163
}
171
164
172
165
protected async onSecondInstance ( event : ElectronEvent , argv : string [ ] , cwd : string ) : Promise < void > {
173
- if ( ! os . isOSX && await this . launchWindowsOpen ( { cwd, argv, secondInstance : true } ) ) {
166
+ if ( ! os . isOSX && await this . launchFromArgs ( { cwd, argv, secondInstance : true } ) ) {
174
167
// Application has received a file in its arguments
175
168
return ;
176
169
}
0 commit comments