fix(wizard): a build whose version folder is spelled verbatim is accepted #299

Merged
HumanBean merged 2 commits from enum/LongshotLauncher:fix/game-folder-check into main 2026-11-27 17:15:26 +00:00
Contributor

On Windows, a build that succeeds is rejected with "The game folder is missing from this version." whenever the versions sit in a data folder apart from the launcher home. An installed launcher keeps its data in %LOCALAPPDATA%\Longshot\data, apart from its home %LOCALAPPDATA%\LongshotLauncher, so every installed copy on Windows takes this path. Fixes MagicBeanDev/Longshot#2661.

Cause

  • library::reserve canonicalizes the versions folder when it is not <home>\versions, so the version folder, and with it the builder's path p.exe, are spelled verbatim: \\?\C:\....
  • The builder started from that path gets its own path from Windows in the plain spelling. std::env::current_exe() gives C:\...; I checked this with a small program that starts itself by its \\?\ path. The builder names its game folder from that path, so the done event's folder is C:\...\builds\default.
  • The check after the build (src/game/wizard.rs) compared folder.parent() with <version>\builds as Paths. Prefix::VerbatimDisk and Prefix::Disk never compare equal, so the check failed although the folder was there, as the player found with Test-Path.

What changes

  • The check is now built_in(folder, version). It compares the two as paths and, on Windows, also as folders on disk (both canonicalized), as Version::owns_build already does. It still refuses a folder that isn't there and one outside the version's builds.
  • After the check the launcher goes on with the folder in its own spelling (<version>\builds\<name>), not the builder's. So versions::register stores the same spelling as the version folder, the one the registry's lookups (new_build's v.folder == folder, register's existing) compare with.
  • Two commits: a Windows test that fails on main for this reason (None for a plain game folder in a verbatim version folder), then the fix.

Read first: built_in in src/game/wizard.rs.

Testing

Tested on Windows 11, RTX 4070, Rust 1.99.1 (msvc):

  • Reproduced and fixed with the real launcher and builder. I used a test launcher home (LONGSHOT_LAUNCHER_HOME) with dataFolder set to a folder outside it, the layout an installed launcher has, and the nightly-842-86b3b9e4 builder.
    • Launcher from main (d61d2e9f): the build finished, then "The build stopped. The game folder is missing from this version." builds\default\longshot.exe was there, 806,823,424 bytes, as in the report.
    • Launcher from this branch, same home: the build finished, the version showed as installed, and Play started the game.
    • The registry row's folder is in the launcher's spelling (\\?\...\builds\default).
  • New test game::wizard::windows_tests::a_game_folder_the_builder_names_plainly_is_in_a_verbatim_version_folder (Windows only, like the prefix): fails on main, passes here.
  • cargo test --locked: 123 passed, 10 failed. main on this PC gives 122 passed and the same 10 failed. They are the Windows-only failures listed in #298 (that list also has update::releases::release_py_fixture_verifies_exact_bytes_only, which passes here). CI runs Linux.
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings: clean. LAUNCHER=$PWD python -I ../Tooling/tests/test_release.py: 46 tests OK. tests/test_launcher_core.py runs the same cargo test, so it stops on those 10 on Windows.

Still to test: None on Windows. Linux is unchanged: there the spellings are the same, and the extra comparison is Windows only.

Measurements

None needed. The change is one check that runs once at the end of a build: two canonicalize calls when the spellings differ, none otherwise. The game, the build's time and size, and the launcher's start are not touched.

Risks

  • A player who already hit this has an unregistered version folder from the failed build. The next build goes into <tag>.instance-2; I saw this in the run above. Existing leftover handling covers the old folder; nothing new here.
  • The comparison on disk runs only when the two spellings differ, and only on Windows.
  • Related, not overlapping: #298 (the Settings folders saved without \\?\) changes how chosen folders are saved, not library::reserve or this check.

🤖 Generated with Claude Code

On Windows, a build that succeeds is rejected with "The game folder is missing from this version." whenever the versions sit in a data folder apart from the launcher home. An installed launcher keeps its data in `%LOCALAPPDATA%\Longshot\data`, apart from its home `%LOCALAPPDATA%\LongshotLauncher`, so every installed copy on Windows takes this path. Fixes https://git.magicbean.dev/MagicBeanDev/Longshot/issues/2661. ## Cause - `library::reserve` canonicalizes the versions folder when it is not `<home>\versions`, so the version folder, and with it the builder's path `p.exe`, are spelled verbatim: `\\?\C:\...`. - The builder started from that path gets its own path from Windows in the plain spelling. `std::env::current_exe()` gives `C:\...`; I checked this with a small program that starts itself by its `\\?\` path. The builder names its game folder from that path, so the `done` event's `folder` is `C:\...\builds\default`. - The check after the build (`src/game/wizard.rs`) compared `folder.parent()` with `<version>\builds` as `Path`s. `Prefix::VerbatimDisk` and `Prefix::Disk` never compare equal, so the check failed although the folder was there, as the player found with `Test-Path`. ## What changes - The check is now `built_in(folder, version)`. It compares the two as paths and, on Windows, also as folders on disk (both canonicalized), as `Version::owns_build` already does. It still refuses a folder that isn't there and one outside the version's `builds`. - After the check the launcher goes on with the folder in its own spelling (`<version>\builds\<name>`), not the builder's. So `versions::register` stores the same spelling as the version folder, the one the registry's lookups (`new_build`'s `v.folder == folder`, `register`'s `existing`) compare with. - Two commits: a Windows test that fails on `main` for this reason (`None` for a plain game folder in a verbatim version folder), then the fix. Read first: `built_in` in `src/game/wizard.rs`. ## Testing **Tested** on Windows 11, RTX 4070, Rust 1.99.1 (msvc): - **Reproduced and fixed with the real launcher and builder.** I used a test launcher home (`LONGSHOT_LAUNCHER_HOME`) with `dataFolder` set to a folder outside it, the layout an installed launcher has, and the nightly-842-86b3b9e4 builder. - Launcher from `main` (d61d2e9f): the build finished, then "The build stopped. The game folder is missing from this version." `builds\default\longshot.exe` was there, 806,823,424 bytes, as in the report. - Launcher from this branch, same home: the build finished, the version showed as installed, and **Play** started the game. - The registry row's `folder` is in the launcher's spelling (`\\?\...\builds\default`). - New test `game::wizard::windows_tests::a_game_folder_the_builder_names_plainly_is_in_a_verbatim_version_folder` (Windows only, like the prefix): fails on `main`, passes here. - `cargo test --locked`: 123 passed, 10 failed. `main` on this PC gives 122 passed and the same 10 failed. They are the Windows-only failures listed in https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/298 (that list also has `update::releases::release_py_fixture_verifies_exact_bytes_only`, which passes here). CI runs Linux. - `cargo fmt --check`, `cargo clippy --locked --all-targets -- -D warnings`: clean. `LAUNCHER=$PWD python -I ../Tooling/tests/test_release.py`: 46 tests OK. `tests/test_launcher_core.py` runs the same `cargo test`, so it stops on those 10 on Windows. **Still to test:** None on Windows. Linux is unchanged: there the spellings are the same, and the extra comparison is Windows only. ## Measurements None needed. The change is one check that runs once at the end of a build: two `canonicalize` calls when the spellings differ, none otherwise. The game, the build's time and size, and the launcher's start are not touched. ## Risks - A player who already hit this has an unregistered version folder from the failed build. The next build goes into `<tag>.instance-2`; I saw this in the run above. Existing leftover handling covers the old folder; nothing new here. - The comparison on disk runs only when the two spellings differ, and only on Windows. - Related, not overlapping: https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/298 (the Settings folders saved without `\\?\`) changes how chosen folders are saved, not `library::reserve` or this check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A version folder in a data folder of its own is reserved by its verbatim
spelling (\?\C:\...) and the builder is started from it, but the builder
names its game folder from its own path, which Windows gives plain. The check
after a build compares the two spellings as paths, so it fails on main.

Refs MagicBeanDev/Longshot#2661

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(wizard): a build whose version folder is spelled verbatim is accepted
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Blocked by required conditions
CI / Rust formatting, lint and tests (pull_request) Blocked by required conditions
CI / Release packages and stable upgrades (pull_request) Blocked by required conditions
PR title / Conventional Commit title (pull_request) Blocked by required conditions
147fcfc397
A version folder in a data folder of its own is reserved by its verbatim
spelling (library::reserve canonicalizes it), and the builder is started from
it. Windows gives the builder its own path plainly, so the game folder it
reports is C:\... while the launcher's is \?\C:\..., and the check after the
build rejected every such build with "The game folder is missing from this
version." An installed launcher on Windows keeps its data in
%LOCALAPPDATA%\Longshot\data, apart from its home, so every installed copy
took this path. The check now compares the folders on disk too, as
Version::owns_build does, and goes on with the launcher's own spelling, the
one its registry lookups use.

Fixes MagicBeanDev/Longshot#2661

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, RTX 4070: a test launcher home with its data folder apart (an installed launcher's layout), nightly-842 builder. main's launcher: build finished, then 'The game folder is missing from this version.' This branch, same home: build finished, version installed, Play started the game.

Tested in game: Windows 11, RTX 4070: a test launcher home with its data folder apart (an installed launcher's layout), nightly-842 builder. main's launcher: build finished, then 'The game folder is missing from this version.' This branch, same home: build finished, version installed, Play started the game.
Member

Possibly related, for context:

  • PR #298 fix(folders): save and read chosen folders without a verbatim prefix — Related Windows verbatim-path handling, but fixes build-cache settings instead
Possibly related, for context: - PR #298 fix(folders): save and read chosen folders without a verbatim prefix — Related Windows verbatim-path handling, but fixes build-cache settings instead
Author
Contributor

Measurements section added: nothing to measure, one check at the end of a build.

Measurements section added: nothing to measure, one check at the end of a build.
enum changed title from WIP: fix(wizard): a build whose version folder is spelled verbatim is accepted to fix(wizard): a build whose version folder is spelled verbatim is accepted 2026-11-27 15:27:24 +00:00
HumanBean deleted branch fix/game-folder-check 2026-11-27 17:15:26 +00:00
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Blocked by required conditions
CI / Rust formatting, lint and tests (pull_request) Blocked by required conditions
CI / Release packages and stable upgrades (pull_request) Blocked by required conditions
PR title / Conventional Commit title (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!299
No description provided.