fix: call site for dll copying
This commit is contained in:
parent
4216680c69
commit
db60f9c433
1 changed files with 59 additions and 50 deletions
|
|
@ -266,13 +266,15 @@ const config: ForgeConfig = {
|
|||
);
|
||||
}
|
||||
},
|
||||
// NOTE: This hook does NOT run when prune: false is set in packagerConfig (line 467).
|
||||
// The empty directory cleanup code below is currently dead code.
|
||||
// DLL bundling has been moved to postPackage which always runs.
|
||||
packageAfterPrune: async (
|
||||
_forgeConfig,
|
||||
buildPath,
|
||||
_electronVersion,
|
||||
platform,
|
||||
_platform,
|
||||
) => {
|
||||
console.error("PRE PACKAGE");
|
||||
try {
|
||||
function getItemsFromFolder(
|
||||
path: string,
|
||||
|
|
@ -332,7 +334,13 @@ const config: ForgeConfig = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error in packageAfterPrune:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
postPackage: async (_forgeConfig, options) => {
|
||||
const { outputPath, platform } = options;
|
||||
// =====================================================================
|
||||
// Bundle VC++ Runtime DLLs for Windows
|
||||
// =====================================================================
|
||||
|
|
@ -355,18 +363,23 @@ const config: ForgeConfig = {
|
|||
// - msvcp140.dll : VC++ Standard Library (C++ runtime)
|
||||
// - vcruntime140.dll : VC++ Runtime (core C runtime)
|
||||
// - vcruntime140_1.dll: VC++ Runtime extension (C++17+ features)
|
||||
//
|
||||
// NOTE: This runs in postPackage (not packageAfterPrune) because prune: false
|
||||
// is set in packagerConfig, which disables the packageAfterPrune hook.
|
||||
// =====================================================================
|
||||
if (platform === "win32") {
|
||||
console.log(
|
||||
`[postPackage] Bundling VC++ runtime DLLs for Windows at ${outputPath}...`,
|
||||
);
|
||||
const vcRuntimeDlls = [
|
||||
"msvcp140.dll",
|
||||
"vcruntime140.dll",
|
||||
"vcruntime140_1.dll",
|
||||
];
|
||||
|
||||
console.log("Bundling VC++ runtime DLLs for Windows...");
|
||||
for (const dll of vcRuntimeDlls) {
|
||||
const src = join("C:", "Windows", "System32", dll);
|
||||
const dest = join(buildPath, dll);
|
||||
const src = `C:\\Windows\\System32\\${dll}`;
|
||||
const dest = join(outputPath, dll);
|
||||
try {
|
||||
copyFileSync(src, dest);
|
||||
console.log(` ✓ Copied ${dll}`);
|
||||
|
|
@ -380,10 +393,6 @@ const config: ForgeConfig = {
|
|||
}
|
||||
console.log("✓ VC++ runtime DLLs bundled successfully");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error in packageAfterPrune:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
},
|
||||
packagerConfig: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue