@@ -144,8 +144,7 @@ export function createSfx(
144
144
145
145
let SfxDirectory = join ( directory , 'SfxPackages' ) ;
146
146
fs . ensureDirSync ( SfxDirectory ) ;
147
- let override =
148
- isWindows ( ) && ( platform == 'linux' || platform == 'darwin' ) ;
147
+ const override = isWindows ( ) && [ 'linux' , 'darwin' ] . includes ( platform ) ;
149
148
let binaryDirectory = Binary ( override ) ;
150
149
let configFile = join ( binaryDirectory . path , 'config.txt' ) ;
151
150
//let configFile = join(SfxDirectory, 'config.txt');
@@ -171,24 +170,29 @@ export function createSfx(
171
170
if ( text ) config . write ( 'ExecuteParameters=' + text + '\n' ) ;
172
171
config . write ( ';!@InstallEnd@!' + '\n' ) ;
173
172
config . close ( ) ;
174
- delete options . title ;
175
- delete options . prompt ;
176
- delete options . beginPrompt ;
177
- delete options . progress ;
178
- delete options . run ;
179
- delete options . runProgram ;
180
- delete options . directory ;
181
- delete options . execute ;
182
- delete options . executeFile ;
183
- delete options . parameters ;
184
- delete options . executeParameters ;
185
- let sfxModule =
186
- type == 'gui' ? '7zwin32.sfx' : '7zCon' + platform + '.sfx' ;
187
- let sfx = name . includes ( extension ) ? name : name + extension ;
188
- let list = Array . isArray ( files )
189
- ? [ configFile ] . concat ( files )
190
- : configFile + ' ' + files ;
191
- sfx = join ( SfxDirectory , sfx ) ;
173
+ [
174
+ 'title' ,
175
+ 'prompt' ,
176
+ 'beginPrompt' ,
177
+ 'progress' ,
178
+ 'run' ,
179
+ 'runProgram' ,
180
+ 'directory' ,
181
+ 'execute' ,
182
+ 'executeFile' ,
183
+ 'parameters' ,
184
+ 'executeParameters'
185
+ ] . forEach ( ( name ) => delete options [ name ] ) ;
186
+ const sfxModule = type === 'gui'
187
+ ? '7zwin32.sfx'
188
+ : `7zCon${ platform } .sfx` ;
189
+ const sfxFilename = name . includes ( extension )
190
+ ? name
191
+ : name + extension ;
192
+ const sfx = join ( SfxDirectory , sfxFilename ) ;
193
+ let list = Array . isArray ( files )
194
+ ? [ configFile , ...files ]
195
+ : `${ configFile } ${ files } ` ;
192
196
let params = Object . assign ( options , {
193
197
sfx : sfxModule ,
194
198
} ) ;
@@ -203,12 +207,10 @@ export function createSfx(
203
207
if ( fs . existsSync ( sfx ) ) {
204
208
return resolve ( sfx ) ;
205
209
/* c8 ignore next 4 */
206
- } else {
207
- console . error ( data ) ;
208
- return reject (
209
- 'Failed! The Sfx application could not be created!'
210
- ) ;
211
- }
210
+ }
211
+
212
+ console . error ( data ) ;
213
+ return reject ( 'Failed! The Sfx application could not be created!' ) ;
212
214
} ) ;
213
215
} )
214
216
. catch ( ( err : string ) => {
0 commit comments