@@ -101,7 +101,8 @@ function downloadMailsync() {
101
101
// For speed, we cache app/node_modules. However, we need to
102
102
// be sure to do a full rebuild of native node modules when the
103
103
// Electron version changes. To do this we check a marker file.
104
- const appModulesPath = path . resolve ( __dirname , '..' , 'app' , 'node_modules' ) ;
104
+ const appPath = path . resolve ( __dirname , '..' , 'app' ) ;
105
+ const appModulesPath = path . resolve ( appPath , 'node_modules' ) ;
105
106
const cacheVersionPath = path . join ( appModulesPath , '.postinstall-target-version' ) ;
106
107
const cacheElectronTarget =
107
108
fs . existsSync ( cacheVersionPath ) && fs . readFileSync ( cacheVersionPath ) . toString ( ) ;
@@ -139,13 +140,19 @@ async function run() {
139
140
await npm ( `ls` , { cwd : './app' , env : 'electron' } ) ;
140
141
141
142
// rebuild sqlite3 using our custom amalgamation, which has USLEEP enabled
142
- if ( await sqliteMissingUsleep ( ) ) {
143
+ if ( process . platform === 'win32' || ( await sqliteMissingUsleep ( ) ) ) {
144
+ // remove the existing build so NPM can't see that it's already present
143
145
rimraf . sync ( path . join ( appModulesPath , 'better-sqlite3' ) ) ;
146
+ // install the module pointing to our local sqlite source with custom #DEFINEs set
147
+ const amalgamationPath = path . join ( appPath , 'build' , 'sqlite-amalgamation' ) ;
144
148
await npm (
145
149
`install better-sqlite3@${ appDependencies [ 'better-sqlite3' ] } ` +
146
- `--no-save --no-audit --build-from-source --sqlite3="$(pwd)/build/sqlite-amalgamation "` ,
150
+ `--no-save --no-audit --build-from-source --sqlite3="${ amalgamationPath } "` ,
147
151
{ cwd : './app' , env : 'electron' }
148
152
) ;
153
+ // remove the build symlinks so that we can build an installer for the app without
154
+ // symlinks out to the sqlite-amalgamation directory.
155
+ rimraf . sync ( path . join ( appModulesPath , 'better-sqlite3' , 'build' , 'Release' , 'obj' ) ) ;
149
156
}
150
157
151
158
// if SQlite was STILL not built with HAVE_USLEEP, do not ship this build! We need usleep
0 commit comments