Skip to content

fix: Patch Bundle.module → resourceURL (two-phase build)#23

Merged
RAKKUNN merged 1 commit intomainfrom
fix/bundle-path-v4
Apr 12, 2026
Merged

fix: Patch Bundle.module → resourceURL (two-phase build)#23
RAKKUNN merged 1 commit intomainfrom
fix/bundle-path-v4

Conversation

@RAKKUNN
Copy link
Copy Markdown
Owner

@RAKKUNN RAKKUNN commented Apr 12, 2026

Problem

SPM generates Bundle.module checking Bundle.main.bundleURL = .app/

  • Putting bundles at .app/ root → codesign rejects ('unsealed contents')
  • Putting bundles at Contents/Resources/ → Bundle.module can't find them

Fix

Two-phase build:

  1. swift build -c release (generates accessor)
  2. sed patches bundleURLresourceURL! (Contents/Resources/)
  3. swift build -c release (rebuilds with patched accessor)

Bundles placed at Contents/Resources/ — correct macOS .app structure.

SPM generates Bundle.module that checks Bundle.main.bundleURL (.app/)
but placing files at .app root causes 'unsealed contents' codesign error.

Fix: Two-phase build — first build generates accessor, sed patches
bundleURL→resourceURL (Contents/Resources/), then rebuilds.
Bundles are copied to Contents/Resources/ which is the standard
macOS .app resource location.
@RAKKUNN RAKKUNN merged commit cf50346 into main Apr 12, 2026
1 check passed
@RAKKUNN RAKKUNN deleted the fix/bundle-path-v4 branch April 12, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant