Skip to content

Mac apps move, import and update whole; links survive a move to another drive - #361

Merged
elripalda merged 4 commits into
elripalda:mainfrom
Xarishark:fix/mac-bundle-moves-imports
Nov 20, 2026
Merged

elripalda merged 4 commits into
elripalda:mainfrom
Xarishark:fix/mac-bundle-moves-imports

Conversation

@Xarishark

@Xarishark Xarishark commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Four Mac fixes that were written as a follow-up to #27 (in thehobbit85#1) but never landed: #27 merged before them, and that PR closed when its branch was deleted. Ported onto current main, which has changed a lot since (updates now go through swap.rs, the menus moved).

A game moved to another drive keeps its links as links (manage.rs, Mac and Linux)

  • Moving to another drive copied every link as a plain file, and a link to a folder stopped the move with "Is a directory". A Mac app's frameworks are links its signature checks; a Linux game unpacked from an AppImage has them too.
  • A link that points into the game's folder by full path (or by its real path, as /var/home on Bazzite) now points at the new place. Any other link is copied as it is, as a move on the same drive keeps it.
  • On a drive that can't hold links (FAT32, exFAT), a link to a file is copied as that file, as before. A drive that can't keep file permissions still doesn't stop the move.
  • Windows: no change in behavior (the copy code was only split into smaller functions).

A Mac app picked when importing a game is the game (adopt.rs, install.rs, Mac only)

  • Picking My Game.app as the folder no longer goes into its Contents folder, and the app's declared program (CFBundleExecutable) starts, never a helper inside it.
  • The app's name identifies the game, since its program may just be called Engine. A folder that holds only the app stays the game's folder.
  • A profile can name the app in start.program ("Game.app"), and a profile that names only Windows/Linux programs no longer rules out the Mac build.

An update of a game imported as a Mac app replaces the app (install.rs, lib.rs, Mac only)

  • When the game's folder is the app itself, the new release's one app goes in place of it, through the same all-or-nothing swap as every update, instead of Game.app/Game.app. Every old file of Contents the new app doesn't ship is taken away (a signed app must hold exactly what it was signed with); {data} beside Contents stays.
  • A release without exactly one app stops before anything changes.

No Add to desktop on a Mac (app.js, tv.js)

  • The shortcut it makes there is Linux's .desktop file, which a Mac ignores. Favorites stays in Add To. Steam items were already hidden on a Mac (Steam isn't looked for there).

Testing

  • Bazzite (Linux) VM: cargo test (914 passed) and node --test tests/*.test.cjs (560 passed). The new Mac import/update tests run there too (they're cfg(unix) and pass "macos").
  • Real move on Bazzite from tmpfs (/tmp) to btrfs (home), with the launcher's own move_dir, of an unpacked AppImage plus a folder link, a full-path link and a link outside it: moved, links intact, the full-path link re-pointed, the program starts from the new place. The same move with main's code fails with "Is a directory" and the game stays where it was.
  • Windows VM: builds without new warnings; the move and copy tests pass (8). And a real move between drives on a Windows PC (NTFS, C: to F: to E:) of a folder with a 64 MB file, a read-only file, a path over 260 characters and a save: every file and folder arrived identical (contents, read-only flag), and the old folder was removed.
  • Not tested: on a real Mac (CI only), and the FAT32/exFAT fallback on a real drive.

Patch notes (Beta 67)

For docs/PATCH-NOTES-0.90-beta-67.md, under Everything else:

  • Mac games picked as an app now import, update and move properly, a game moved to another drive on Linux or Mac keeps its links so it still starts, and a Mac no longer offers Add to desktop, which did nothing there. — Fixed by @Xarishark (#361).

For the website (SDK guide): none.

@thehobbit85

Copy link
Copy Markdown
Contributor

@Xarishark I reviewed and tested this on my Apple Silicon Mac (arm64, macOS 26.6, build 25G5028f), at dffe229. The existing suites and native app build pass, and the main fixes work in the native smoke tests. I reproduced three edge cases that I think we should address before merging.

  1. [P2] Refresh the saved executable after replacing an imported app — lib.rs:741–744

    Reproduction: import an app whose CFBundleExecutable is Engine, then update it to a release that declares Engine2 and no longer contains Engine. The update succeeds and the new app passes signature verification and launches directly, but the saved executable remains Contents/MacOS/Engine, which has been deleted.

    The previous executable is retained before old_app_files is added to dropped; afterward, the nonempty exe prevents rediscovery. The local harness follows the production do_install ordering through dropped, updated_exe, the swap, and final executable selection. Its failure is:

    saved executable is missing after successful update: Contents/MacOS/Engine
    

    Please refresh automatically selected executables from the updated bundle's metadata, while respecting explicit user selections. Moving old_app_files into the deletion filtering earlier handles the removed-binary case; consulting the new metadata also handles an old executable that remains as a helper.

  2. [P2] Account for case-only renames when identifying obsolete files — install.rs:929–933

    Reproduction on case-insensitive APFS: update a signed app containing Contents/Resources/Artwork.txt to one containing Contents/Resources/artwork.txt. The exact-path comparison adds the old spelling to leftovers, while the swap already schedules that same file as a replacement under its new spelling. Moving it a second time fails:

    The update couldn't move Contents/Resources/Artwork.txt (No such file or directory (os error 2)). Nothing was changed: the game is as it was before the update.
    

    I verified that rollback restores the old app's signature and launchability, so this is a blocked update, not observed data loss. Please avoid duplicate removal using the destination filesystem's path/case behavior, while retaining correct cleanup on case-sensitive volumes.

  3. [P2] Preserve the destination of external relative links during cross-drive moves — manage.rs:114–117

    Reproduction: a game has Game/asset.dat -> ../Shared/asset.dat. Move the game to a different filesystem where that sibling Shared folder does not exist. move_dir returns success and removes the source game folder, but the recreated relative link now points at the new location's missing Shared/asset.dat; reading the asset fails with ENOENT.

    This was a real move from the host filesystem onto a mounted APFS image. The exact upstream baseline move code preserves the file's data in the same comparison test. Please keep internal framework links relative, but anchor or rebase external targets so they still resolve to the original destination.

Mac validation completed:

  • Existing Rust suite: 888 passed, 1 ignored, 0 failed; binary and doc-test targets also passed.
  • Existing UI suite: 549 passed, 11 skipped, 0 failed (560 total).
  • JavaScript syntax checks for ui/app.js and ui/tv.js, and diff whitespace checks passed.
  • Native debug .app build passed; its executable is arm64 and codesign --verify --deep --strict passed.
  • Additional local native review harness: 8 passed, 3 failed, corresponding to the three findings above. These extra tests are not committed to this PR.
  • Passing scenarios included importing by bundle metadata/name, a real cross-filesystem move preserving framework links/signature/launch, a normal signed-app update, saved-data preservation, rollback, and rejecting releases with zero or two replacement apps.

The native checks used disposable, ad-hoc-signed Mach-O app/framework fixtures and the launcher's Rust functions, with actual execution of the fixture apps. This was not a GUI end-to-end or real-game gameplay test. ZIP fixtures used ditto --sequesterRsrc. Save preservation and strict signature verification were tested separately: placing recompdata in the app root invalidates a strict signature even before an update, so I am not counting that pre-existing behavior as a regression here.

@elripalda
elripalda marked this pull request as ready for review November 20, 2026 21:56
@elripalda
elripalda merged commit b0d6d0f into elripalda:main Nov 20, 2026
6 checks passed
@Xarishark

Copy link
Copy Markdown
Collaborator Author

@thehobbit85 thanks for testing this on a real Mac; all three reproduced in the code. This PR merged before they were fixed, so the fixes are in #377, one commit each:

  1. The old app's files are counted before the program to keep is chosen, and for a game imported as an app the launcher's own pick is dropped, so after the update it's found again from the new CFBundleExecutable. A program the player picked stays while the update keeps it.
  2. An old file is left out of the ones to take away when the drive says it's the same file (device and inode) as one the new app ships, so a case-only rename on case-insensitive APFS goes in, and on a case-sensitive drive the old spelling still goes.
  3. A relative link out of the game now points at the same place by full path after a cross-drive move; a relative link that stays inside the game (frameworks) stays relative.

Each has tests. The case-only test does its real check on CI's macos-15 runner. If your native harness is handy, a run of it against #377 would be very welcome.

@Xarishark
Xarishark deleted the fix/mac-bundle-moves-imports branch November 23, 2026 23:56
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.

3 participants