[core] Fix required disk space calculation, once and for all

This commit is contained in:
derrod 2022-01-02 13:08:14 +01:00
parent 202f07973a
commit 8e4bb8d3dd

View file

@ -1372,15 +1372,8 @@ class LegendaryCore:
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:
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
# Ensure that we have enough disk space for the installation process, as calculated by the analyser
min_disk_space = analysis.disk_space_delta
_, _, free = shutil.disk_usage(base_path)
if free < min_disk_space:
free_mib = free / 1024 / 1024