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,23 +1103,29 @@ class LegendaryCore:
|
||||||
if not install.can_run_offline:
|
if not install.can_run_offline:
|
||||||
results.warnings.add('This game is not marked for offline use (may still work).')
|
results.warnings.add('This game is not marked for offline use (may still work).')
|
||||||
|
|
||||||
# check if enough disk space is free (dl size is the approximate amount the installation will grow)
|
base_path = os.path.split(install.install_path)[0]
|
||||||
min_disk_space = analysis.install_size
|
if os.path.exists(base_path):
|
||||||
if updating:
|
# check if enough disk space is free (dl size is the approximate amount the installation will grow)
|
||||||
current_size = get_dir_size(install.install_path)
|
min_disk_space = analysis.install_size
|
||||||
delta = max(0, analysis.install_size - current_size)
|
if updating:
|
||||||
min_disk_space = delta + analysis.biggest_file_size
|
current_size = get_dir_size(install.install_path)
|
||||||
|
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:
|
if free < min_disk_space:
|
||||||
free_mib = free / 1024 / 1024
|
free_mib = free / 1024 / 1024
|
||||||
required_mib = min_disk_space / 1024 / 1024
|
required_mib = min_disk_space / 1024 / 1024
|
||||||
if ignore_space_req:
|
if ignore_space_req:
|
||||||
results.warnings.add(f'Potentially not enough available disk space! '
|
results.warnings.add(f'Potentially not enough available disk space! '
|
||||||
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
|
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
|
||||||
else:
|
else:
|
||||||
results.failures.add(f'Not enough available disk space! '
|
results.failures.add(f'Not enough available disk space! '
|
||||||
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
|
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
|
# 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
|
executables = [f for f in analysis.manifest_comparison.added if
|
||||||
|
|
Loading…
Reference in a new issue