fix: accurate disk space check on Linux #27
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/ui
area/updates
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!27
Loading…
Reference in a new issue
No description provided.
Delete branch "korbo/LongshotLauncher:fix/disk-space"
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?
what this fixes: on linux, check the directory directly for its disk space
I couldn't build on bazzite linux because the existing code calculated me as having 0 GB free space with the
composefson /how i tested it: built it myself and ran it, and now i can use the Build button in the launcher.
Thanks, this fixes the real problem: on Bazzite
/homeis a link to/var/home,GetFullPathkeeps the link, so the old mount matching picked the composefs root with 0 bytes free. Asking statvfs about the folder itself (whichnew DriveInfo(dir)does on Unix) follows the link to the right filesystem.One thing to fix before merge:
Disk.DriveNamestill matches mounts by the unresolved path, so it now disagrees withFreeBytes. On Bazzite the settings step will say "200 GB free on /", and when the real filesystem is short, "/ is too full for the build", which points the player at the wrong drive. Details inline.Also, please add to the description how you tested it (CONTRIBUTING asks for why, what changed and how it was tested): did you run
tests/test_launcher_core.py, and did the launcher on Bazzite show the right free space afterwards?@ -67,1 +67,4 @@}// Unix accepts a directory here and asks the filesystem holding it for space.// Let the OS follow links and mounts.if (!OperatingSystem.IsWindows()) return new DriveInfo(at).AvailableFreeSpace;This gives the right number, but
DriveName(below, not in the diff) still picks the longest mount root that the unresolved path starts with. For/home/you/...on Bazzite it returns/, while this now measures/var.SettingsStepViewModelpairs the two (MeterText: "{f} GB free on {Drive}",SpaceWarning: "{Drive} is too full for the build"), so the window names the wrong mount.Could both use the same resolved location? For example a small helper that resolves links along the path (walk the components,
ResolveLinkTarget(returnFinalTarget: true)whereLinkTarget != null), used byDriveNameon Unix; then this line can stay as is, orFreeBytescould keep its mount matching on the resolved path so the two can't drift apart again. A check next to yours thatDriveName(linkedMount) == "/proc"would hold it.ok I can fix DriveName too
yeah I was just wondering if either OS will accept
return new DriveInfo(at).AvailableFreeSpacetbh@ -422,0 +423,4 @@{// Follow links for disk space accuracy.var linkedMount = Path.Combine(root, "other-mount");Directory.CreateSymbolicLink(linkedMount, "/proc");Nit: say why
/proc: its statvfs reports 0 free, so the check fails if the link isn't followed (the old code would report the free space whererootis). Comparing withnew DriveInfo("/proc").AvailableFreeSpacerestates the implementation;== 0with that comment reads more plainly.Thanks for the fix, korbo! This PR doesn't allow maintainers to push to its branch, so it's carried on in #29. That PR keeps your commit as it is and adds the
DriveNamefix from the review on top. Closing this one in favour of it.Pull request closed