@@ -50,7 +50,9 @@ if (isBuilding) {
50
50
console . log ( '=====================' ) ;
51
51
52
52
try {
53
- removeSync ( join ( __dirname , 'resources' , 'app' ) ) ;
53
+ const appPath = join ( __dirname , 'resources' , 'app' ) ;
54
+
55
+ removeSync ( appPath ) ;
54
56
55
57
// As we can't copy into a subdirectory of ourself we need to copy to a temp directory
56
58
let tmpDir = mkdtempSync ( join ( os . tmpdir ( ) , 'nativephp' ) ) ;
@@ -87,16 +89,16 @@ if (isBuilding) {
87
89
}
88
90
} ) ;
89
91
90
- copySync ( tmpDir , join ( __dirname , 'resources' , 'app' ) ) ;
92
+ copySync ( tmpDir , appPath ) ;
91
93
92
94
// Electron build removes empty folders, so we have to create dummy files
93
95
// dotfiles unfortunately don't work.
94
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'framework' , 'cache' , '_native.json' ) , { } )
95
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'framework' , 'sessions' , '_native.json' ) , { } )
96
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'framework' , 'testing' , '_native.json' ) , { } )
97
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'framework' , 'views' , '_native.json' ) , { } )
98
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'app' , 'public' , '_native.json' ) , { } )
99
- writeJsonSync ( join ( __dirname , 'resources' , 'app' , 'storage' , 'logs' , '_native.json' ) , { } )
96
+ writeJsonSync ( join ( appPath , 'storage' , 'framework' , 'cache' , '_native.json' ) , { } )
97
+ writeJsonSync ( join ( appPath , 'storage' , 'framework' , 'sessions' , '_native.json' ) , { } )
98
+ writeJsonSync ( join ( appPath , 'storage' , 'framework' , 'testing' , '_native.json' ) , { } )
99
+ writeJsonSync ( join ( appPath , 'storage' , 'framework' , 'views' , '_native.json' ) , { } )
100
+ writeJsonSync ( join ( appPath , 'storage' , 'app' , 'public' , '_native.json' ) , { } )
101
+ writeJsonSync ( join ( appPath , 'storage' , 'logs' , '_native.json' ) , { } )
100
102
101
103
removeSync ( tmpDir ) ;
102
104
@@ -106,7 +108,9 @@ if (isBuilding) {
106
108
console . log ( '=====================' ) ;
107
109
108
110
// We'll use the default PHP binary here, as we can cross-compile for all platforms
109
- execSync ( `php ${ join ( __dirname , 'resources' , 'app' , 'artisan' ) } native:minify ${ join ( __dirname , 'resources' , 'app' ) } ` ) ;
111
+ const phpBinary = join ( process . env . APP_PATH , 'vendor' , 'nativephp' , 'electron' , 'resources' , 'js' , 'resources' , 'php' , 'php' ) ;
112
+ const artisanPath = join ( appPath , 'artisan' ) ;
113
+ execSync ( `${ phpBinary } ${ artisanPath } native:minify ${ appPath } ` ) ;
110
114
} catch ( e ) {
111
115
console . error ( '=====================' ) ;
112
116
console . error ( 'Error copying app to resources' ) ;
0 commit comments