diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index fddaf84..02c7937 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -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; diff --git a/Bloxstrap/Helpers/Utilities.cs b/Bloxstrap/Helpers/Utilities.cs index 11530c4..75b4488 100644 --- a/Bloxstrap/Helpers/Utilities.cs +++ b/Bloxstrap/Helpers/Utilities.cs @@ -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 });