Propose a game folder only on a fixed drive.

When the launcher's drive has less than 40 GB free, the proposed game folder goes to the drive with the most free
space, and a mapped network share or a USB drive was counted: the 26 GB RomFS image and the build would go there.
Only fixed drives are counted now, as the docs say.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 08:55:59 -05:00
parent 7b467f6686
commit d0e9ba6b30

View File

@@ -38,6 +38,18 @@ def ansi_safe(path):
return False
def fixed_drive(drive):
"""True when drive (X:\\) is a fixed disk (GetDriveTypeW DRIVE_FIXED), not a network, removable or optical drive.
True where that cannot be asked."""
if os.name != 'nt':
return True
try:
import ctypes
return ctypes.windll.kernel32.GetDriveTypeW(str(drive)) == 3
except (AttributeError, OSError):
return True
class Layout:
def __init__(self, root=None, app=None):
self.app = Path(app or APP)
@@ -93,6 +105,8 @@ class Layout:
import string
for letter in string.ascii_uppercase[2:]:
drive = Path(f'{letter}:\\')
if not fixed_drive(drive): # a mapped network share or a USB stick is no place for 30 GB of build
continue
try:
free = shutil.disk_usage(drive).free
except OSError: