mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
35 lines
878 B
C#
35 lines
878 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Linq;
|
|
|
|
namespace Bloxstrap.Utility
|
|
{
|
|
internal static class Filesystem
|
|
{
|
|
internal static long GetFreeDiskSpace(string path)
|
|
{
|
|
foreach (DriveInfo drive in DriveInfo.GetDrives())
|
|
{
|
|
if (path.StartsWith(drive.Name))
|
|
return drive.AvailableFreeSpace;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
internal static void AssertReadOnly(string filePath)
|
|
{
|
|
var fileInfo = new FileInfo(filePath);
|
|
|
|
if (!fileInfo.IsReadOnly)
|
|
return;
|
|
|
|
fileInfo.IsReadOnly = false;
|
|
App.Logger.WriteLine("Filesystem::AssertReadOnly", $"The following file was set as read-only: {filePath}");
|
|
}
|
|
}
|
|
}
|