Fix potential bug with filesystem space checker

This commit is contained in:
pizzaboxer 2024-06-28 16:43:34 +04:00
parent ec418261ea
commit c6c722e733
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8

View File

@ -11,9 +11,10 @@ namespace Bloxstrap.Utility
{ {
internal static long GetFreeDiskSpace(string path) internal static long GetFreeDiskSpace(string path)
{ {
foreach (DriveInfo drive in DriveInfo.GetDrives()) foreach (var drive in DriveInfo.GetDrives())
{ {
if (path.StartsWith(drive.Name)) // https://github.com/pizzaboxer/bloxstrap/issues/1648#issuecomment-2192571030
if (path.ToUpperInvariant().StartsWith(drive.Name))
return drive.AvailableFreeSpace; return drive.AvailableFreeSpace;
} }