mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[core] Fix required disk space calculation, once and for all
This commit is contained in:
parent
202f07973a
commit
8e4bb8d3dd
|
@ -1372,15 +1372,8 @@ class LegendaryCore:
|
||||||
|
|
||||||
base_path = os.path.split(install.install_path)[0]
|
base_path = os.path.split(install.install_path)[0]
|
||||||
if os.path.exists(base_path):
|
if os.path.exists(base_path):
|
||||||
# check if enough disk space is free (dl size is the approximate amount the installation will grow)
|
# Ensure that we have enough disk space for the installation process, as calculated by the analyser
|
||||||
min_disk_space = analysis.install_size
|
min_disk_space = analysis.disk_space_delta
|
||||||
if updating:
|
|
||||||
current_size = get_dir_size(install.install_path)
|
|
||||||
delta = max(0, analysis.install_size - current_size)
|
|
||||||
min_disk_space = delta + analysis.biggest_file_size
|
|
||||||
elif analysis.reuse_size:
|
|
||||||
min_disk_space -= analysis.reuse_size
|
|
||||||
|
|
||||||
_, _, free = shutil.disk_usage(base_path)
|
_, _, 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
|
||||||
|
|
Loading…
Reference in a new issue