mirror of
https://github.com/derrod/legendary.git
synced 2025-01-03 04:45:28 +00:00
[core] Check if base path exists, add failure condition if it doesn't
This commit is contained in:
parent
3aad87e1a9
commit
74bc2fecc0
|
@ -1103,6 +1103,8 @@ class LegendaryCore:
|
|||
if not install.can_run_offline:
|
||||
results.warnings.add('This game is not marked for offline use (may still work).')
|
||||
|
||||
base_path = os.path.split(install.install_path)[0]
|
||||
if os.path.exists(base_path):
|
||||
# check if enough disk space is free (dl size is the approximate amount the installation will grow)
|
||||
min_disk_space = analysis.install_size
|
||||
if updating:
|
||||
|
@ -1110,7 +1112,7 @@ class LegendaryCore:
|
|||
delta = max(0, analysis.install_size - current_size)
|
||||
min_disk_space = delta + analysis.biggest_file_size
|
||||
|
||||
_, _, free = shutil.disk_usage(os.path.split(install.install_path)[0])
|
||||
_, _, free = shutil.disk_usage(base_path)
|
||||
if free < min_disk_space:
|
||||
free_mib = free / 1024 / 1024
|
||||
required_mib = min_disk_space / 1024 / 1024
|
||||
|
@ -1120,6 +1122,10 @@ class LegendaryCore:
|
|||
else:
|
||||
results.failures.add(f'Not enough available disk space! '
|
||||
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
|
||||
else:
|
||||
results.failures.add(f'Install path "{base_path}" does not exist, make sure all necessary mounts are '
|
||||
f'available. If you previously deleted the game folder without uninstalling, run '
|
||||
f'"legendary uninstall -y {game.app_name}" first.')
|
||||
|
||||
# check if the game actually ships the files or just a uplay installer + packed game files
|
||||
executables = [f for f in analysis.manifest_comparison.added if
|
||||
|
|
Loading…
Reference in a new issue