mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user