fix: support Windows/Linux paths in afterPack hook

The afterPack script only searched macOS-specific paths
(CodePilot.app/Contents/Resources) for better_sqlite3.node replacement.
Add Windows/Linux path (resources/standalone/) so the native module
ABI fix works on all platforms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
7418andClaude Opus 4.6 committed 2026-02-07 14:28:38 +08:00
1 parent b819eb7601
commit 0bf97a3795
1 file changed
+6 -4
+6 -4
View File
@@ -27,12 +27,14 @@ module.exports = async function afterPack(context) {
}
// Find all better_sqlite3.node files inside the standalone resources
const resourcesDir = path.join(appOutDir, 'CodePilot.app', 'Contents', 'Resources');
// On macOS the structure is: <appOutDir>/CodePilot.app/Contents/Resources/standalone/...
// But appOutDir might already point to the .app parent, so try both
// macOS: <appOutDir>/CodePilot.app/Contents/Resources/standalone/...
// Windows/Linux: <appOutDir>/resources/standalone/...
const searchRoots = [
path.join(resourcesDir, 'standalone'),
// macOS paths
path.join(appOutDir, 'CodePilot.app', 'Contents', 'Resources', 'standalone'),
path.join(appOutDir, 'Contents', 'Resources', 'standalone'),
// Windows/Linux paths
path.join(appOutDir, 'resources', 'standalone'),
];
let replaced = 0;