mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Check disk space based on manifest sizes
This commit is contained in:
parent
580173d31c
commit
903fc42128
@ -659,10 +659,14 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
SetStatus(FreshInstall ? "Installing Roblox..." : "Upgrading Roblox...");
|
SetStatus(FreshInstall ? "Installing Roblox..." : "Upgrading Roblox...");
|
||||||
|
|
||||||
// check if we have at least 300 megabytes of free disk space
|
// package manifest states packed size and uncompressed size in exact bytes
|
||||||
if (Utilities.GetFreeDiskSpace(Directories.Base) < 1024*1024*300)
|
// packed size only matters if we don't already have the package cached on disk
|
||||||
|
string[] cachedPackages = Directory.GetFiles(Directories.Downloads);
|
||||||
|
int totalSizeRequired = _versionPackageManifest.Where(x => !cachedPackages.Contains(x.Signature)).Sum(x => x.PackedSize) + _versionPackageManifest.Sum(x => x.Size);
|
||||||
|
|
||||||
|
if (Utilities.GetFreeDiskSpace(Directories.Base) < totalSizeRequired)
|
||||||
{
|
{
|
||||||
App.ShowMessageBox($"{App.ProjectName} requires at least 300 MB of disk space to install Roblox. Please free up some disk space and try again.", MessageBoxImage.Error);
|
App.ShowMessageBox($"{App.ProjectName} does not have enough disk space to download and install Roblox. Please free up some disk space and try again.", MessageBoxImage.Error);
|
||||||
App.Terminate(ERROR_INSTALL_FAILURE);
|
App.Terminate(ERROR_INSTALL_FAILURE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -727,7 +731,7 @@ namespace Bloxstrap
|
|||||||
ReShade.SynchronizeConfigFile();
|
ReShade.SynchronizeConfigFile();
|
||||||
|
|
||||||
// let's take this opportunity to delete any packages we don't need anymore
|
// let's take this opportunity to delete any packages we don't need anymore
|
||||||
foreach (string filename in Directory.GetFiles(Directories.Downloads))
|
foreach (string filename in cachedPackages)
|
||||||
{
|
{
|
||||||
if (!_versionPackageManifest.Exists(package => filename.Contains(package.Signature)))
|
if (!_versionPackageManifest.Exists(package => filename.Contains(package.Signature)))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user