mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-05-14 20:24:42 -07:00
Add check for free disk space
This commit is contained in:
parent
bdf84693ad
commit
84233ea254
@ -461,6 +461,14 @@ namespace Bloxstrap
|
||||
else
|
||||
Dialog.Message = "Upgrading Roblox...";
|
||||
|
||||
// check if we have at least 300 megabytes of free disk space
|
||||
if (Utilities.GetFreeDiskSpace(Directories.Base) < 1024*1024*300)
|
||||
{
|
||||
Program.ShowMessageBox($"{Program.ProjectName} requires at least 300 MB of disk space to install Roblox. Please free up some disk space and try again.", MessageBoxIcon.Error);
|
||||
Program.Exit(ERROR_INSTALL_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(Directories.Base);
|
||||
|
||||
Dialog.CancelEnabled = true;
|
||||
|
@ -7,6 +7,17 @@ namespace Bloxstrap.Helpers
|
||||
{
|
||||
public class Utilities
|
||||
{
|
||||
public static long GetFreeDiskSpace(string path)
|
||||
{
|
||||
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
||||
{
|
||||
if (path.StartsWith(drive.Name))
|
||||
return drive.AvailableFreeSpace;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void OpenWebsite(string website)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo { FileName = website, UseShellExecute = true });
|
||||
|
Loading…
Reference in New Issue
Block a user