Skip to content

fix: only detect real .app bundle paths in pathToFuseFile#123

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/app-substring-path-resolution
Jun 29, 2026
Merged

fix: only detect real .app bundle paths in pathToFuseFile#123
MarshallOfSound merged 1 commit into
mainfrom
fix/app-substring-path-resolution

Conversation

@claude

@claude claude Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

Before

pathToFuseFile() (and the ad-hoc codesign reset in flipFuses()) decided whether the Electron binary lives inside a macOS .app bundle using pathToElectron.includes('.app'). That bare substring check false-positives whenever any ancestor directory merely contains .app in its name. For example, building from a project under /home/user/.app/electron-app/ (or a Windows folder like my.app.win) made the resolver believe it was on macOS and route into the bundle path, producing errors such as:

Error: ENOENT: no such file or directory, open '/home/user/.app/electron-app/dist/Frameworks/Electron Framework.framework/Electron Framework'

After

Only genuine macOS .app bundle paths are treated as bundles. Building from a directory whose name happens to contain .app on Linux/Windows resolves the Electron binary path unchanged, as expected.

How

Both .includes('.app') call sites are replaced with regexes that match the real bundle layout instead of an arbitrary substring:

  • In pathToFuseFile(), the inner-binary branch now matches \.app[\\/]Contents[\\/]MacOS[\\/] — i.e. the actual Something.app/Contents/MacOS/… structure that precedes the ../../Frameworks/… resolution.
  • In flipFuses(), the resetAdHocDarwinSignature codesign reset now matches an anchored path segment(^|[\\/])[^\\/]+\.app([\\/]|$) — so a <name>.app directory is detected as a bundle while names like .app or my.app.win are not.

pathToFuseFile is now exported so the path-resolution logic can be unit-tested directly without downloading Electron binaries.

Tests

Adds test/path-resolution.spec.ts with regression coverage:

  • A real .app bundle path and its inner Contents/MacOS/Electron binary path are still resolved to the framework binary (positive cases).
  • A Linux path under a .app-named ancestor (#118) and a Windows path under my.app.win (#95) are returned unchanged and not treated as macOS bundles.

Closes #118
Closes #95

#95 is the same root cause (.includes('.app') false-positive at both call sites) and is fixed here.

🤖 Generated with Claude Code

https://claude.ai/code/session_019E2Tyh4thR7TKQqfLcVUXh


Generated by Claude Code

pathToFuseFile() and the ad-hoc codesign reset in flipFuses() used
pathToElectron.includes('.app') to decide whether the Electron binary
lives inside a macOS .app bundle. That substring check false-positives
when an ancestor directory merely contains '.app' (e.g. '/home/user/.app/'
or 'my.app.win'), wrongly routing into the macOS bundle path on Linux
and Windows and producing ENOENT errors.

Replace both substring checks with regexes that match the real bundle
layout: '.app/Contents/MacOS/' for the inner-binary resolution, and an
anchored path-segment match ('<name>.app' bounded by separators) for the
codesign reset. Export pathToFuseFile so the path-resolution logic can be
unit-tested without downloading Electron binaries.

Closes #118
Closes #95
@MarshallOfSound
MarshallOfSound marked this pull request as ready for review June 28, 2026 16:26
@MarshallOfSound
MarshallOfSound requested a review from a team as a code owner June 28, 2026 16:26
@MarshallOfSound
MarshallOfSound merged commit 00f2479 into main Jun 29, 2026
9 checks passed
@MarshallOfSound
MarshallOfSound deleted the fix/app-substring-path-resolution branch June 29, 2026 18:02
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants