fix(home): on Windows, Delete leaves out game files a folder with no row still holds #101
No reviewers
Labels
No labels
area/build
area/install
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!101
Loading…
Reference in a new issue
No description provided.
Delete branch "madebyjordan/LongshotLauncher:fix/frees-links-outside"
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?
Why
On Windows, Delete can say it frees the ~26 GB of game files a version shares with a folder that has no row. Until #57 lands, every update leaves such a folder: it builds into a new folder, links the game files from the old one (#58), and the old folder stays on the disk.
Disk.Measuregets file IDs on Windows from the folder listing, which has no link count, so a file counts as freed when no other listed version holds it. Linux already uses the link count.What changed
Core/Disk.csMeasure: on Windows, a file whose links seen so far all sit in one folder (the only files that folder's delete could free) is asked for its link count, on up to 8 threads. A file two listed versions share is never freed by deleting either, so it isn't asked. Nothing changes on Linux, where statx already gives the count.Walknow passes each file's path.Core/FileLinks.csWindowsLinks(path, id): one open of the file withFILE_READ_ATTRIBUTES(never its data) andGetFileInformationByHandle. It returns the link count only if the file is still the one the listing named (volume serial and file index), else 0, and the count then goes by the links seen, as before.tests/launcher_coreMeasureChecks: the twoFreeschecks expect the same on Windows as on Linux. A link outside every listed build (elsewhere/outside) is not freed, and a file linked twice inside one build is.Cost
Measured on this PC (Ryzen 5 5600, NVMe, Windows 11) on the installed game folder (
nightly-189, ~187,000 files, no version sharing its files), through the PC's job queue, main and this branch alternated, 2 runs of 3 rounds each:Disk.Measurefa3a444About 3 s more per version whose files no other listed version shares (fewer files are asked when versions share them). Measure runs in the background, only when a version was built, updated or deleted, and its figures are kept in builds.json. A first try during a game update on the same PC was noise for both (33 to 60 s) and is left out.
Testing
python -I tests/test_launcher_core.pyon Windows (.NET 10.0.404), output to a file: 1137 checks pass. The symbolic-link fixtures are skipped (no Developer Mode). Two local workarounds were needed for the run, and both are needed on main too:core.autocrlf=false). A fresh Windows checkout withcore.autocrlf=truegets them with CRLF, andReleaseChecksfails on main as on this branch.root = Path(folder).resolve()in the runner. Without it,InstallChecksfails on main as on this branch, because the temp folder's short 8.3 name (C:\Users\LONGNA~1\...) doesn't match the full paths the checks expect.Disk.csandFileLinks.csand this branch's check, the run fails at "Deleting a build frees only its files with no link outside its folder.", so the check covers the fix.frees 1010where deleting frees 10.dotnet buildof the app: no warnings.Based on main @
fa3a444.🤖 Generated with Claude Code