fix(desktop): collapse unpacked dirs when merging universal apps (#4025)

This commit is contained in:
Hampus authored and GitHub committed 2026-11-11 02:05:08 +01:00
1 parent d1bfa96779
commit eca9380661
3 files changed
+44 -2

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
diff --git a/dist/asar-utils.js b/dist/asar-utils.js
index 636fa9599d23cf1bfc61f9f4b2c4b5e64f9c94d9..964bd54a0bc1b6817268f3bc28cc15655a923e4e 100644
--- a/dist/asar-utils.js
+++ b/dist/asar-utils.js
@@ -140,7 +140,34 @@ export const mergeASARs = async ({ x64AsarPath, arm64AsarPath, outputAsarPath, s
execFileSync(LIPO, [source, destination, '-create', '-output', destination]);
}
d(`creating archive at ${outputAsarPath}`);
- const resolvedUnpack = Array.from(unpackedFiles).map((file) => path.join(x64Dir, file));
+ const packedFiles = [];
+ for (const [archive, files] of [[x64AsarPath, x64Files], [arm64AsarPath, arm64Files]]) {
+ for (const file of files) {
+ const stat = asar.statFile(archive, file);
+ if ('files' in stat || ('unpacked' in stat && stat.unpacked)) {
+ continue;
+ }
+ packedFiles.push(file);
+ }
+ }
+ const mixedDirs = new Set();
+ for (const file of packedFiles) {
+ for (let dir = path.dirname(file); dir !== '.' && dir !== '/' && dir !== ''; dir = path.dirname(dir)) {
+ mixedDirs.add(dir);
+ }
+ }
+ const unpackEntries = new Set();
+ for (const file of unpackedFiles) {
+ let top = null;
+ for (let dir = path.dirname(file); dir !== '.' && dir !== '/' && dir !== ''; dir = path.dirname(dir)) {
+ if (mixedDirs.has(dir)) {
+ break;
+ }
+ top = dir;
+ }
+ unpackEntries.add(top === null ? file : path.join(top, '**'));
+ }
+ const resolvedUnpack = Array.from(unpackEntries).map((entry) => path.join(x64Dir, entry));
let unpack;
if (resolvedUnpack.length > 1) {
unpack = `{${resolvedUnpack.join(',')}}`;
+3 -2
View File
@@ -471,6 +471,7 @@ overrides:
zod@^4: 4.6.7
patchedDependencies:
'@electron/[email protected]': 89eb2c71ca988f424f2c75cf28b566b156c55b06a0b6cd01d06f9a6763e754bb
'@phosphor-icons/[email protected]': 9b0b481de857aa7a7525f023baea9da72be4574ff72825e39d959e6979d78eea
[email protected]: 65d0567cd2da382764aee3839187feb5284662c4a9f0b755f1e52163c5e36399
[email protected]: 343c47e52467ec6018beff92d73b6ca2cf231399d98116925687451e8bd527d8
@@ -14013,7 +14014,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@electron/[email protected]([email protected])':
'@electron/[email protected](patch_hash=89eb2c71ca988f424f2c75cf28b566b156c55b06a0b6cd01d06f9a6763e754bb)([email protected])':
dependencies:
'@electron/asar': 4.1.1
debug: 4.4.3([email protected])
@@ -16666,7 +16667,7 @@ snapshots:
'@electron/notarize': 3.1.1([email protected])
'@electron/osx-sign': 2.4.0([email protected])
'@electron/rebuild': 4.2.0([email protected])
'@electron/universal': 3.0.4([email protected])
'@electron/universal': 3.0.4(patch_hash=89eb2c71ca988f424f2c75cf28b566b156c55b06a0b6cd01d06f9a6763e754bb)([email protected])
'@malept/flatpak-bundler': 0.4.0([email protected])
'@noble/hashes': 2.4.0
'@peculiar/webcrypto': 1.7.1
+1
View File
@@ -199,6 +199,7 @@ overrides:
zod@^4: 'catalog:'
patchedDependencies:
'@electron/[email protected]': patches/@[email protected]
'@phosphor-icons/[email protected]': patches/@[email protected]
[email protected]: patches/[email protected]
[email protected]: patches/[email protected]