feat(versions): versions are their folders, and an update changes a version in place #352
No reviewers
Labels
No labels
area/build
area/install
area/mods
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!352
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "HumanBean/LongshotLauncher:feat/version-folders-in-place"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The launcher kept every version in one versions.json beside the folders, and updated a version by building the new release in a staging folder and swapping it in, with retired folders kept for rollback. Two copies of the truth drifted apart, and the swap is the most fragile step a player runs. This PR makes each version folder describe itself and updates a version where it is.
What changes
Versions are folders (commit 1)
version.json, written last when its build completes: id, tag, channel, game source, upscaler modules, earlier tags, created and updated. A folder with it is a complete version; without it, it is not one. No retired or half-registered states.<id>-<16 hex>), the first keeps it.library.json. If it is lost, only the default choice is lost.version.jsonwith the same id, so profile.jsonversionand Steam--play <id>keep working. Playable folders the old launcher found without listing them get their oldcopy-<sha256>or folder-name id. The list is kept asversions.json.backup; builds.json is never written.library.json, written last, marks the migration done; an unreadable list leaves everything as it is and is tried again on the next start.Update in place (commit 2)
fetchor the signed download, into a temporary folder inside the version, then moved over the old tools, builder last), records the new tag, then runs the builder'sbuildthere. No staging version folder, no swap:replace_instance, the upgrade file carrying, retired folders and prune's retired cleanup are removed.builds/default. The update is refused while the version or its profile is in use (players::ensure_paths_idle); on Windows a file in use is retried for 3 s, then a message names the file and says to close it and choose Update again.build --profile <profile> --game β¦ --language β¦ --upscaler β¦ [--accept-licenses β¦]. The update keeps the folder's built language and its modules. Everybuildandfetchcommand line comes from one function each insrc/game/builder_cli.rs, so a later PR changes the flags in one place. The builder repo is unchanged.previousFolder,previousVersion,retiredFolders, therollbackVersion/updatedToVersionsettings and the storage scan's rollback pin are gone. No rollback UI existed, so no screen changes.Docs (commit 3): docs/paths.md (new "Updating a version" section) and the README line on game updates.
Old retired folders removed (commit 4): folders an earlier launcher retired or left from a staged update (its
.longshot-retiredreceipt, or named in the oldretiredFolders) are removed once by the migration and again by each update in place. Only a folder the launcher owns that noversion.jsondescribes, that no profile names or holds its game in, that nothing uses (ensure_paths_idle), and that holds no saves or settings. A failure is logged and the update carries on.Commit 1 does not build by itself (the wizard still calls the old registration); review in order, build the head.
Supersedes the dedupe idea of #351 (closed): several instances of one tag stay separate.
Checks
cargo check --locked --tests,cargo clippy --locked --all-targets -- -D warnings,cargo fmt --checkpass on Linux.update_tools, tool replacement, prune, retired-folder removal, recovery, folder moves) but not run: no tests are run on the PC this was written on. CI runs them.cfg!expressions only.π€ Generated with Claude Code
Possibly related, for context:
WIP: feat(versions): versions are their folders, and an update changes a version in placeto feat(versions): versions are their folders, and an update changes a version in place