Closed DrSkunk closed 4 months ago
Under the hooks documentation I found the key afterPack
. Using that I implemented my own copying function for asset movement. I'll be testing this:
const { Arch, Platform } = require("electron-builder");
const fs = require("fs/promises");
const path = require("path");
module.exports = async function afterPack(context) {
let appName;
let to;
if (context.packager.platform === Platform.MAC) {
appName = `app-darwin-${Arch[context.arch]}`;
to = path.resolve(
context.appOutDir,
`${context.packager.appInfo.productFilename}.app`,
"Contents",
"Resources",
appName
);
} else if (context.packager.platform === Platform.WINDOWS) {
appName = `app-win32-${Arch[context.arch]}.exe`;
to = path.resolve(context.appOutDir, "resources", appName);
} else {
throw new Error(
`Could not determine platform. Should be either '${Platform.MAC.name}' or '${Platform.WINDOWS.name}', but was: ${context.packager.platform}`
);
}
const from = path.resolve("..", "app", "dist", "build", appName);
try {
console.log(`Copying "${from}" to "${to}"`);
await fs.copyFile(from, to);
} catch (error) {
console.error(error);
throw new Error(
`Could not copy "${from}" to "${to}".\n Did you build the app first and ran the 'movebinary' script?`
);
}
};
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.
My electron application works as a GUI wrapper to start a subprocess. This is copied with
extraResources
key under each platform. However, the subprocess needs to be copied per architecture. Up until new we only supported x64.Would it be possible to set
extraResources
per target instead of either global or per platform?Or is it possible to have an intermediary build step where I can run a script which copies the appropriate binary?
Excerpt of my config:
Suggested config:
Thanks in advance.