fix(versions): Remove keeps a version's own profile, so the version can go #387
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!387
Loadingβ¦
Reference in a new issue
No description provided.
Delete branch "llun/LongshotLauncher:fix/386-keep-version-profile"
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?
A player could not remove a version, and nothing in the Launcher let them past it: every Remove stopped with "This folder contains protected data at "profile"" and the dialog stayed open (#386). Removal now keeps that profile as a Launcher profile, then removes the version.
Why it happens
<version>/profile/is longshot-builder's default profile. A game started without the Launcher's--profile(itsLongshot.exeopened from the version folder, or a shortcut aimed at it) keeps its saves, settings and mods there. Builders before Longshot's nightly-837 always used it for such a start, portable libraries included (Longshot #2629 and #2773 taught the builder to find the Launcher's profiles since). Removal treats anyprofileentry in a version as the player's data and refuses, which is right, but it gave the player no way forward. The log only said "Game operation did not complete".What changes
<version>/profilemoves to the Launcher's profiles (copied, compared, then the original removed; a copy is dropped again if the original cannot go, so trying again never makes two), then the version is removed as before. Any other protected data in the version still stops the removal, the profile untouched.profilecounts. Another spelling (Profilebeside it on a case-sensitive file system) is the player's own data and still stops the removal, so nothing is moved and nothing deleted.game,licenses,start_slot,upscalers).docs/saves.mddescribes it.Tested
removal_keeps_the_versions_own_profile_as_a_launcher_profile, first commit: fails with the reporter's message, passes with the fix; the removal and i18n tests rerun after the rebase ontomain), plus tests that other protected data still stops removal before the profile moves, that another spelling ofprofilestops it too, that Remove everything with the saves takes the version's own profile, that a kept profile keeps a free name of its own (Unicode case), that its name follows the Launcher's language, and that a box ticked in an earlier dialog never carries over. The tests that move a profile run in their own process with no game counted as running (as the players tests do), so a game open elsewhere on the PC cannot decide them.cargo fmtand locked Clippy with-D warningson Windows, rebased onto #388 (which made Clippy pass on Windows again),scripts/translations.py(15 catalogs), Tooling'stests/test_release.py(46 tests).cargo teston Windows 11: the same 12 environment-dependent tests (folder moves, links, Steam, portable home, storage) fail onmainand here; none touch this code, and every removal test passes.profile/(6 saves, as the builder writes it). In Portuguese, as in the report: the dialog says the profile is kept, Remover removed the version, the notice named "Saves de nightly-951-28cb22b9", and that profile showed its 6 saves, byte-identical to the original. While anotherlongshot.exewas running, removal refused as before and left the profile in place. Screenshots in the comments, the dialog's box in English and Portuguese too (nothing removed for those: Cancel); the save list is left out, its thumbnails coming from the game.Not covered
profile/is still refused, by the earlier extra-entry check. It is rarer and kept out of this change.π€ Generated with Claude Code
The profile a removed version leaves is named in the launcher's language ("Saves de nightly-951-β¦" in Portuguese), and the notice after removal and the "Version removed." status are looked up in the catalogs, all 12 translated. Co-Authored-By: Claude Opus 5.5 <[email protected]>Screenshots from the Launcher on Windows 11, in Portuguese as in the report (the library folder line in the dialog is blanked).
The Remove dialog, with the new note that the version's own profile is kept:

After Remover, the notice names the new profile:

The kept profile in the profile switcher, with its 6 saves:

Possibly related, for context:
@review
Recommendation: Request changes. On case-sensitive filesystems, removal can delete an extra profile without preserving it. Bulk removal can also leave saves behind after the player chose to remove them.
The change lets players remove a version while keeping its own profile and reports the new profile in the launcher. It adds a copy and comparison before removal, but the profile scan and bulk-cleanup interaction need correction.
Blocking (2): must change before merging.
src/game/versions.rs:641: The scan silently replaces an already discovered profile with another case-insensitive match. (more on the line) Do: Reject multiple matching profile directories before moving anything, or preserve every matching directory.src/game/mod.rs:174: Bulk removal discards the retained-profile result and can recreate player data after the reviewed profile folder has been removed. (more on the line) Do: Make bulk cleanup handle version-owned profiles according to the reviewed include-profiles choice, and ensure its final state matches the reviewed removal plan.Should fix (1): not blocking, but worth doing before merging.
src/players/profiles.rs:418: The name collision check uses ASCII-only case folding, unlike normal profile creation and renaming. (more on the line) Do: Use the same Unicode lowercase comparison asnew_or_renamefor both adopted and generated names.@fixcan do L1, L2 and L3.Checks: Still running: 5 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows 11 run removed the affected version and showed all six saves in the retained profile; the added synthetic test also covers the reported failure.
Other systems: The change affects Windows and Linux filesystem operations, profile storage, and bulk cleanup. The reported interactive run covers Windows; the case-sensitive directory issue affects Linux filesystems. Bulk cleanup can recreate profiles after its reviewed profile directory has already been removed.
Switches: None.
Reviewed:
b72a9cb560against1fb25370b1: Read AGENTS.md, CONTRIBUTING.md, the commit log, the complete diff, and the changed profile, i18n and Slint files. Read the changed removal code and surrounding scan, storage cleanup, copy and process-check paths; skimmed the translation additions and existing tests. No review checklist or pull request template was present. Other changed Rust files were reviewed through their diffs and relevant callers, not in full.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project or tests were run. The reported Windows removal and translation tests passed; CI was still running.
Overlaps and merge order: None found in the supplied context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -172,3 +172,3 @@anyhow::anyhow!("Only an installed Longshot version can be removed here.")})?;versions::delete(home, &version)versions::delete(home, &version).map(drop)L2 (blocking): Bulk removal discards the retained-profile result and can recreate player data after the reviewed profile folder has been removed.
When: When Remove everything includes profiles and the profiles path sorts before a version path, cleanup removes the profiles folder first. Removing a version with its own profile then recreates that folder and copies the saves into it; cleanup reports success and exits even though the player requested their removal. With a custom data folder, resetting preferences can also leave those saves at an unconfigured location.
Do: Make bulk cleanup handle version-owned profiles according to the reviewed include-profiles choice, and ensure its final state matches the reviewed removal plan.
@ -623,1 +638,4 @@let path = e.path();// Not scanned: it moves to the launcher's profiles whole, its saves with it.if keep_own_profile && dir == folder && name == OWN_PROFILE && players::is_dir(&path) {tree.own_profile = Some(path);L1 (blocking): The scan silently replaces an already discovered profile with another case-insensitive match.
When: On Linux, a version can contain both
profileandProfile. Both are skipped by the protection scan, but only the last one is adopted; the other remains in the version directory and is deleted with it, including any saves it contains.Do: Reject multiple matching profile directories before moving anything, or preserve every matching directory.
@ -375,0 +415,4 @@disk::same_tree(source, stage.path())?,"This versionβs own profile changed while it was copied. Close Longshot and try again.");let taken = |name: &str| all.iter().any(|p| p.name().eq_ignore_ascii_case(name));L3 (should fix): The name collision check uses ASCII-only case folding, unlike normal profile creation and renaming.
When: If an existing profile is named
Γmilieand the adopted profile is namedΓ©milie, adoption keeps both names, although the profile editor rejects that pair as duplicates.Do: Use the same Unicode lowercase comparison as
new_or_renamefor both adopted and generated names.3a3ad6cf5360f978d6afThanks for the review: all three are fixed in
561993c, and the branch is rebased onto #388.profileandProfileon a case-sensitive file system): only the builder's exactprofileis set aside now, compared by its exact name, not lowercased. Any other spelling is the player's own data and stops the removal before anything moves (only_the_builders_exact_profile_name_is_kept_another_spelling_stops_removal).profilesfolder is made again after the cleanup removed it; unticked, it is kept as a profile in the kept profiles folder (removing_everything_with_the_saves_takes_the_versions_own_profile_too).new_or_renamedoes, Unicode lowercase, for both the profile's own name and the generated one (Γmilie/Γ©miliecase added toa_kept_profile_keeps_its_own_name_unless_another_profile_has_it).Also new in
60f978d: the Remove dialog of a version that has its own profile gets a box, unticked each time it opens, to delete that profile with the version instead of keeping it; the note above it says which will happen. Both texts are in the 12 translated catalogs.Checked on Windows 11 after the rebase:
cargo fmt --check, locked Clippy with-D warnings(no allowances now that #388 is in), and the removal, dialog, cleanup and i18n tests (16 passed). The tests that move a profile now run in their own process with no game counted as running, asplayers::testsdoes: a game open elsewhere on the PC made them fail, rightly, since saves move only while no game runs.The box in English and Portuguese (scratch library, Cancel pressed each time, nothing removed; the folder line is blanked):
@review
Recommendation: Approve. The three ledger issues are fixed, and the reported Windows run shows that removal preserves the profile and its saves. The required CI checks are still running. Nothing blocking is left. Recommend approval; not approved on the forge.
Removal can preserve a versionβs own profile as a Launcher profile, or delete it when the player explicitly chooses to. This makes the blocked removal workflow usable, at the cost of additional profile-copying and cleanup logic.
Since the last review (on
b72a9cb560)Resolved: L1 (The scan silently replaces an already discovered profile with another case-insensitive matβ¦); L2 (Bulk removal discards the retained-profile result and can recreate player data after the rβ¦); L3 (The name collision check uses ASCII-only case folding, unlike normal profile creation andβ¦)
Checks: Still running: 5 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports a Windows 11 Launcher run in which removal preserved six byte-identical saves and displayed the resulting profile. This is not a performance change.
Other systems: The change affects version removal, profile storage and bulk cleanup on Windows and Linux. The reported interactive run was on Windows; the changed exact-name scan also handles case-sensitive filesystems in code.
Switches: The Remove dialog adds an unchecked-by-default choice to delete the versionβs own profile; keeping saves by default is appropriate. Bulk cleanup follows its existing include-profiles choice.
Reviewed:
60f978d6afagainst2ab8b52062: Read the repository rules, pull request description and comments, diff statistics and commits, and the relevant removal, profile adoption and bulk cleanup code. Skimmed the remaining diff; did not read every changed code file or translation catalog in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports passing removal, dialog, cleanup and i18n tests and a Windows interactive run; CI remains in progress.
Overlaps and merge order: None found.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@review
Recommendation: Approve. The reported Windows removal case is shown working, with the versionβs profile preserved. CI is still running. Nothing blocking is left. Recommend approval; not approved on the forge.
Version removal preserves the versionβs own profile by default and offers an explicit choice to delete it; bulk cleanup follows the saves choice. The change adds profile-copying and removal logic in exchange for giving affected players a way to remove the version.
Since the last review (on
60f978d6af)Nothing changed in the ledger.
Checks: Still running: 5 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes: the author reports removing a nightly on Windows 11 and finding all six saves byte-identical in the retained profile. This is not a performance change.
Other systems: The change affects Windows and Linux filesystem operations, profile storage, bulk cleanup and the removal dialog. The recorded interactive run is on Windows; the author reports game-free removal and cleanup tests.
Switches: The removal dialog adds a delete-own-profile checkbox, unticked each time; keeping the profile is the appropriate default. Bulk cleanup uses its existing saves choice.
Reviewed:
60f978d6afagainst2ab8b52062: Read AGENTS.md and CONTRIBUTING.md; inspected the diff, the version-removal and cleanup paths, profile adoption, dialog wiring and recorded evidence. The full changed source files and translation catalogs were not all read in full; translations and tests were skimmed.; nothing run (a code review).Checked and fine:
Testing: No commands or tests from the project were run. The author reports Windows removal, dialog, cleanup and i18n tests and an interactive Windows run; CI is still running.
Overlaps and merge order: The author reports a rebase onto #388; no other overlap was established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.