@@ -28,15 +28,13 @@ const {
28
28
class NwBuilder {
29
29
constructor ( options ) {
30
30
this . init ( options ) . then ( ( ) => {
31
- this . _platforms = { ...Platforms } ;
32
-
33
- // clear all unused platforms
34
- for ( const name in this . _platforms ) {
35
- if (
36
- this . options . platforms &&
37
- this . options . platforms . indexOf ( name ) === - 1
38
- )
39
- delete this . _platforms [ name ] ;
31
+ /* Make a shallow copy of the Platforms object */
32
+ this . platforms = Object . assign ( { } , Platforms ) ;
33
+ /* Clear all unused platforms */
34
+ for ( const platform of Object . keys ( this . platforms ) ) {
35
+ if ( ! options . platforms . includes ( platform ) ) {
36
+ delete this . platforms [ platform ] ;
37
+ }
40
38
}
41
39
} ) . catch ( ( error ) => {
42
40
console . error ( error ) ;
@@ -467,7 +465,7 @@ class NwBuilder {
467
465
self . _files ,
468
466
self ,
469
467
JSON . stringify (
470
- self . _platforms [ platformName ] . platformSpecificManifest ,
468
+ self . platforms [ platformName ] . platformSpecificManifest ,
471
469
) ,
472
470
zipOptions ,
473
471
) . then ( function ( file ) {
@@ -595,8 +593,8 @@ class NwBuilder {
595
593
var executableName = self . getExecutableName ( name ) ;
596
594
597
595
await fs . promises . rename (
598
- resolve ( platform . releasePath , "nwjs.app" ) ,
599
- resolve ( platform . releasePath , executableName ) ,
596
+ path . resolve ( platform . releasePath , "nwjs.app" ) ,
597
+ path . resolve ( platform . releasePath , executableName ) ,
600
598
) ;
601
599
602
600
// Let's first handle the mac icon
@@ -691,8 +689,8 @@ class NwBuilder {
691
689
var executablePath = path . resolve ( platform . releasePath , executableName ) ;
692
690
693
691
await fs . promises . rename (
694
- resolve ( platform . releasePath , "nw.exe" ) ,
695
- resolve ( platform . releasePath , executableName ) ,
692
+ path . resolve ( platform . releasePath , "nw.exe" ) ,
693
+ path . resolve ( platform . releasePath , executableName ) ,
696
694
) ;
697
695
698
696
var rcConf = { } ;
@@ -782,7 +780,7 @@ class NwBuilder {
782
780
}
783
781
784
782
_forEachPlatform ( fn ) {
785
- _ . forEach ( this . _platforms , function ( platform , name ) {
783
+ _ . forEach ( this . platforms , function ( platform , name ) {
786
784
return fn ( name , platform ) ;
787
785
} ) ;
788
786
}
0 commit comments