Skip to content

Launcher: never save the shell root at the root of a volume (#492) - #493

Merged
v0lumehi merged 3 commits into
mainfrom
fix/shell-root
Nov 2, 2026
Merged

v0lumehi merged 3 commits into
mainfrom
fix/shell-root

Conversation

@LNPANDY

@LNPANDY LNPANDY commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Fix or feature

  • Fix

What and why

A user's iPhone build failed at 准备共用应用 with "You can't save the file 'NX2Apple-shell' because 'Macintosh HD' is a read-only volume" (#492). ShellLibrary.resolveRoot computes <parent>/NX2Apple-shell and saves it on its first call. The Settings page shows the shell cache path before a game or output folder is chosen, so the first call could have parent == ""; ("" as NSString).deletingLastPathComponent is "", and the saved root became /NX2Apple-shell, at the root of the read-only system volume. Every later build used it and only failed at the last step, after the whole build.

  • ShellLibrary.previewRoot (ShellRoot.swift): the Settings row previews the root and saves nothing.
  • ShellLibrary.resolveRoot: an empty, / or relative parent falls back to the home folder; a saved root at a volume root (/NX2Apple-shell) is repaired and replaced.
  • ShellInstall.canWriteRoot: a build checks its shell folder before its long steps and stops with shell.rootUnwritable (five languages) naming the folder, instead of failing at the end.
  • Users who already have the bad value are repaired on their next build; the defaults delete org.nxnative.NSPortBuilder shellRoot workaround is in the issue for anyone who wants it now.
  • The third commit regenerates frontend-qt/nspb_qt/localization.py: the Qt front end's check requires its table to carry every key.
  • The second commit makes the copy-incomplete assertion in ShellInstallTests language-independent: it split the English template on ": ", so it ran red on a Chinese macOS (full-width colon) and stopped every push at the pre-push hook. Unrelated to Shared-app build fails at the last step on a read-only volume: a saved shell root of /NX2Apple-shell #492, but needed to run the suite on this machine; CI never saw it (English).

SourceSizeTests: ContentView.swift and Localization.swift stay within their line budget — the BuildModel members moved to ShellRoot.swift, and four wrapped localization entries were joined (formatting only).

Fixes #492

Checked

  • Tests: cd frontend && swift test → 701 tests, 17 skipped, 0 failures (macOS 26.6.2, Chinese UI)
  • Visual QA: None, no visible change (the Settings row keeps its label and layout; a user with the broken saved value sees the repaired path instead of /NX2Apple-shell)
  • Run on a device or Mac: not run; no device runtime behavior changed. The preflight is covered by testRootNeedsAWritableParent and the empty-parent/repair tests.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: not applicable, no engine change
  • A change to a launcher view has before and after screenshots above: no visible change
  • No keys, game files or data extracted from a game in the change or the attachments

resolveRoot() saves <parent>/NX2Apple-shell the first time it runs. The
Settings page reads that path before a game or output folder is chosen, so
the parent was "" and the saved root became /NX2Apple-shell on the read-only
system volume. Every later build failed at the last step ("Macintosh HD" is
read-only) after the whole build.

The Settings row now previews the root and saves nothing, an empty, "/" or
relative parent falls back to the home folder, a saved root at a volume root
is repaired, and a build checks that the shell folder can be written before
it starts, naming the folder to change.
The assertion split the English template on ": " to cut off the tool's error.
A Chinese macOS formats the sentence with a full-width colon, so the split
kept the whole sentence and the test ran red on main there (CI is English),
which stopped every push from that Mac at the pre-push hook. Mark the error
slot instead: the cut then works in every language.
@LNPANDY LNPANDY added the bug Something isn't working label Nov 2, 2026
@github-actions github-actions Bot added the launcher The NX2Apple launcher app label Nov 2, 2026
frontend-qt/gen_localization.py keeps nspb_qt/localization.py in step with
Localization.swift; the new key makes the Qt front end's check fail until
the generated table carries it.
@github-actions github-actions Bot added the windows Windows (the Qt front end) label Nov 2, 2026
@v0lumehi v0lumehi added this to the v1.0.1 milestone Nov 2, 2026
@v0lumehi

v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

I read the diff. The fix is right. The empty parent was the cause, the preview no longer saves anything, a saved /NX2Apple-shell is repaired, and the build checks the folder before its long steps. CI is green. I did not run it on a device.

Two small points. Neither blocks the merge:

  • rootIsUsable accepts any absolute path with two components, so a saved /Volumes/Fridge would pass. Nothing writes that today, so I would leave it.
  • canWriteRoot is false when neither the root nor its parent exists, and the message then says "read-only volume or no permission". The output folder exists in a normal build, so this is fine.

This lands on main before my launcher stack (#456 to #485). Both change BuildModel and ContentView.swift, and the stack removes them. If this merges first, I port ShellRoot.swift into the stack myself.

@LNPANDY I think this belongs in v1.0.1. The bug is in 1.0.0 and the build fails only at the last step, after the whole build. The change is small and tested. It would mean a third release candidate. I set the milestone to v1.0.1 and you can move it. Is that OK for you?

@v0lumehi
v0lumehi merged commit d769c55 into main Nov 2, 2026
14 checks passed
v0lumehi added a commit that referenced this pull request Nov 2, 2026
Port of #493 (ShellRoot.swift, a BuildModel extension) into the stores: shellCachePath, shellRootParent, shellRoot and shellRootProblem() now live in BuildStore+ShellRoot.swift, the preflight is called in BuildStore+Run.swift before the long steps. ShellLibrary and ShellInstall changes of #493 applied to NXCore/ShellInstall.swift (package access). ContentView.swift keeps this branch's version (BuildModel is gone).
@v0lumehi
v0lumehi deleted the fix/shell-root branch November 2, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working launcher The NX2Apple launcher app windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared-app build fails at the last step on a read-only volume: a saved shell root of /NX2Apple-shell

2 participants