mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-06-23 23:00:23 -07:00
Compare commits
3 Commits
98eea57db4
...
18ec23df5a
Author | SHA1 | Date | |
---|---|---|---|
|
18ec23df5a | ||
|
dbdd0e37d6 | ||
|
1e3f76a2fd |
@ -1525,7 +1525,7 @@ namespace Bloxstrap
|
||||
var regexList = new List<string>();
|
||||
|
||||
foreach (string file in files)
|
||||
regexList.Add("^" + file.Replace("\\", "\\\\") + "$");
|
||||
regexList.Add("^" + file.Replace("\\", "\\\\").Replace("(", "\\(").Replace(")", "\\)") + "$");
|
||||
|
||||
fileFilter = String.Join(';', regexList);
|
||||
}
|
||||
|
@ -11,14 +11,21 @@ namespace Bloxstrap.Utility
|
||||
{
|
||||
internal static long GetFreeDiskSpace(string path)
|
||||
{
|
||||
foreach (var drive in DriveInfo.GetDrives())
|
||||
try
|
||||
{
|
||||
// https://github.com/bloxstraplabs/bloxstrap/issues/1648#issuecomment-2192571030
|
||||
if (path.ToUpperInvariant().StartsWith(drive.Name))
|
||||
return drive.AvailableFreeSpace;
|
||||
var isUri = Uri.TryCreate(p, UriKind.RelativeOrAbsolute, out var u);
|
||||
if (!Path.IsPathRooted(p) || !Path.IsPathFullyQualified(p) || (isUri && (u?.IsUnc??false)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
var drive = new DriveInfo(p);
|
||||
return drive.AvailableFreeSpace;
|
||||
}
|
||||
|
||||
return -1;
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
App.Logger.WriteLine("Filesystem::BadPath", $"The path: {p} does not contain a valid drive info.");
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
internal static void AssertReadOnly(string filePath)
|
||||
|
Loading…
Reference in New Issue
Block a user