Skip to content

Commit

Permalink
patch: use @electron/remote for locating rpiboot files
Browse files Browse the repository at this point in the history
  • Loading branch information
mcraa committed Feb 15, 2023
1 parent 6538864 commit 04fa3dc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,26 @@ const commonConfig = {
`,
replace: "require('./build/Release/Generator.node')",
}),
replace(/node_modules\/node-raspberrypi-usbboot\/build\/index\.js$/, {
search:
"return await readFile(Path.join(__dirname, '..', 'blobs', filename));",
replace: outdent`
const remote = require('@electron/remote');
return await readFile(
Path.join(
// With macOS universal builds, getAppPath() returns the path to an app.asar file containing an index.js file which will
// include the app-x64 or app-arm64 folder depending on the arch.
// We don't care about the app.asar file, we want the actual folder.
remote.app.getAppPath().replace(/\\.asar$/, () => process.platform === 'darwin' ? '-' + process.arch : ''),
'generated',
__dirname.replace('node_modules', 'modules'),
'..',
'blobs',
filename
)
);
`,
}),
// Copy native modules to generated folder
{
test: /\.node$/,
Expand Down

0 comments on commit 04fa3dc

Please sign in to comment.