add storage space check

This commit is contained in:
bluepilledgreat 2025-03-12 22:14:01 +00:00
parent 073a59b889
commit 6c09f7c479

View File

@ -400,11 +400,20 @@ namespace Bloxstrap
private bool IsEligibleForBackgroundUpdate() private bool IsEligibleForBackgroundUpdate()
{ {
// TODO: storage check const string LOG_IDENT = "Bootstrapper::IsEligibleForBackgroundUpdate";
if (App.LaunchSettings.BackgroundUpdaterFlag.Active || _mustUpgrade || IsStudioLaunch) if (App.LaunchSettings.BackgroundUpdaterFlag.Active || _mustUpgrade || IsStudioLaunch)
return false; return false;
// at least 3GB of free space
const long minimumFreeSpace = 3_000_000_000;
long space = Filesystem.GetFreeDiskSpace(Paths.Base);
if (space < minimumFreeSpace)
{
App.Logger.WriteLine(LOG_IDENT, $"User has {space} free space, at least {minimumFreeSpace} is required");
return false;
}
if (_latestVersion == default) // todo: check if this even works if (_latestVersion == default) // todo: check if this even works
return false; return false;