fix(builder): a portable launcher's games keep their files in the portable folder #3090

Merged
HumanBean merged 1 commit from HumanBean/Longshot:fix/portable-paths into main 2026-12-03 16:08:38 +00:00
Owner

Summary

Under a portable launcher, Longshot still wrote into the player's own folders: a player saw AppData\Roaming\Longshot,
AppData\Local\Longshot, and AMD and Intel folders appear after starting the game. This PR moves what is Longshot's into
the portable folder:

  • The game's user folder (recordings, mod screenshots, mouse sensitivity, mod item journal, temporary files) is the
    profile's user/, not %APPDATA%\Longshot or ~/.local/share/longshot. What that shared folder already held of the
    player's is copied there once, and kept.
  • The Windows sandbox's record and crash dumps are in sandbox\ in the portable data folder. sandbox-revoke reads that
    record and the old per-user one.
  • Linux: the game's Mesa and NVIDIA caches are in driver-cache/ of the portable cache, and the unused
    ~/.local/share/longshot/nfc is no longer made when tags live elsewhere.
  • Installed and portable (Windows): driver shader cache folders are made only for the GPU vendors the PC has.

The builder knows it is portable from LONGSHOT_PORTABLE_DATA (set by the launcher; real environment only), else from the
versions/ folder it runs in. Start with builder/crates/build-core/src/portable.rs, then user_folder.rs.

Windows still creates Packages\longshot.game for the AppContainer, and the drivers keep their own caches; neither can be
moved. The docs now say so. Launcher side: MagicBeanDev/LongshotLauncher#412. See MagicBeanDev/LongshotLauncher#266

Testing

Tested: Linux, game-free only. Not run in the game.

  • cargo fmt, clippy with warnings as errors on build-core, build-driver, longshot-builder, modtool, and on
    build-core for x86_64-pc-windows-gnullvm.
  • cargo test -p build-core -p build-driver -p longshot-builder: all pass. One run had
    cursor_clip::the_watch_runs_while_a_clip_is_held_and_ends_after (untouched here) fail; it passed on the rerun.
  • cargo test -p modtool in full before the last Linux changes, its state:: tests after them.
  • tests/test_sandbox_linux.py, test_sandbox_windows.py, test_sandbox_profile.py, test_doc_anchors.py,
    test_doc_commands.py.

Still to test:

  • Windows, portable launcher: start the game, expecting no new Roaming\Longshot or Local\Longshot, files under
    Longshot\data\profiles\<id>\user and Longshot\data\sandbox, and the sandbox on (by hand).
  • Windows with one GPU vendor and no existing folders of the others: no AMD or Intel folder appears, and the driver's
    own cache fills (by hand).
  • Linux, portable launcher: start the game, expecting the same under the portable folder and driver-cache/ filling (by hand).
  • Windows and Linux, installed launcher: start the game, expecting no change in where files go (by hand).

Measurements

Not measured: where files go changes, no per-frame code does. Linux portable players start with an empty driver cache once.

Risks

  • Portable players' recordings and screenshots appear in the profile's user folder from now on; the old ones stay.
  • Linux portable: the drivers compile their caches again once.
  • A GPU whose vendor the registry lookup misses would get no new cache folder. If no vendor is found at all, every folder is
    made, as before.
  • A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (Not run in the game yet.)
  • mise run test passes (any failure that also fails on main is named). (Not run; only the checks above.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (The new tests pass here; not run against main.)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Under a **portable** launcher, Longshot still wrote into the player's own folders: a player saw `AppData\Roaming\Longshot`, `AppData\Local\Longshot`, and `AMD` and `Intel` folders appear after starting the game. This PR moves what is Longshot's into the portable folder: - **The game's user folder** (recordings, mod screenshots, mouse sensitivity, mod item journal, temporary files) is the profile's `user/`, not `%APPDATA%\Longshot` or `~/.local/share/longshot`. What that shared folder already held of the player's is copied there once, and kept. - **The Windows sandbox's record and crash dumps** are in `sandbox\` in the portable data folder. `sandbox-revoke` reads that record and the old per-user one. - **Linux:** the game's Mesa and NVIDIA caches are in `driver-cache/` of the portable cache, and the unused `~/.local/share/longshot/nfc` is no longer made when tags live elsewhere. - **Installed and portable (Windows):** driver shader cache folders are made only for the GPU vendors the PC has. The builder knows it is portable from `LONGSHOT_PORTABLE_DATA` (set by the launcher; real environment only), else from the `versions/` folder it runs in. Start with `builder/crates/build-core/src/portable.rs`, then `user_folder.rs`. Windows still creates `Packages\longshot.game` for the AppContainer, and the drivers keep their own caches; neither can be moved. The docs now say so. Launcher side: https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/412. See https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/issues/266 ## Testing **Tested:** Linux, game-free only. **Not run in the game.** - `cargo fmt`, clippy with warnings as errors on `build-core`, `build-driver`, `longshot-builder`, `modtool`, and on `build-core` for `x86_64-pc-windows-gnullvm`. - `cargo test -p build-core -p build-driver -p longshot-builder`: all pass. One run had `cursor_clip::the_watch_runs_while_a_clip_is_held_and_ends_after` (untouched here) fail; it passed on the rerun. - `cargo test -p modtool` in full before the last Linux changes, its `state::` tests after them. - `tests/test_sandbox_linux.py`, `test_sandbox_windows.py`, `test_sandbox_profile.py`, `test_doc_anchors.py`, `test_doc_commands.py`. **Still to test:** - Windows, portable launcher: start the game, expecting no new `Roaming\Longshot` or `Local\Longshot`, files under `Longshot\data\profiles\<id>\user` and `Longshot\data\sandbox`, and the sandbox on (by hand). - Windows with one GPU vendor and no existing folders of the others: no `AMD` or `Intel` folder appears, and the driver's own cache fills (by hand). - Linux, portable launcher: start the game, expecting the same under the portable folder and `driver-cache/` filling (by hand). - Windows and Linux, installed launcher: start the game, expecting no change in where files go (by hand). ## Measurements Not measured: where files go changes, no per-frame code does. Linux portable players start with an empty driver cache once. ## Risks - Portable players' recordings and screenshots appear in the profile's `user` folder from now on; the old ones stay. - Linux portable: the drivers compile their caches again once. - A GPU whose vendor the registry lookup misses would get no new cache folder. If no vendor is found at all, every folder is made, as before. - A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (Not run in the game yet.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (Not run; only the checks above.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [ ] A fix: a game-free test that fails on `main` and passes here. (The new tests pass here; not run against `main`.) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(builder): a portable launcher's games keep their files in the portable folder
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Failing after 7s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 18s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m19s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 16m37s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m56s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m48s
CI / Website build and checks (pull_request) Successful in 1m17s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 49m15s
9bc40667a8
The game's user folder, the Windows sandbox's record and crash dumps, and
the Linux driver caches went to the player's own folders even under a
portable Longshot Launcher. The Windows sandbox also made every GPU
vendor's driver cache folder on every PC.

Assisted-by: Claude Code
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner

Linked the launcher's half, LongshotLauncher#412.

Linked the launcher's half, LongshotLauncher#412.
HumanBean changed title from WIP: fix(builder): a portable launcher's games keep their files in the portable folder to fix(builder): a portable launcher's games keep their files in the portable folder 2026-12-03 16:08:34 +00:00
HumanBean deleted branch fix/portable-paths 2026-12-03 16:08:39 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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/Longshot!3090
No description provided.