1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-23 08:13:01 +00:00

Free disk space should be faster on drive pools

This commit is contained in:
Mark McDowall 2013-07-11 17:07:21 -07:00
parent f6ec58ecd5
commit ef42034e38

View file

@ -264,19 +264,19 @@ public virtual long GetAvilableSpace(string path)
throw new DirectoryNotFoundException(path); throw new DirectoryNotFoundException(path);
var driveInfo = DriveInfo.GetDrives().SingleOrDefault(c => c.IsReady && c.Name.Equals(Path.GetPathRoot(path), StringComparison.CurrentCultureIgnoreCase)); if (OsInfo.IsLinux)
if (driveInfo == null)
{ {
if (OsInfo.IsLinux) var driveInfo = DriveInfo.GetDrives().SingleOrDefault(c => c.IsReady && c.Name.Equals(Path.GetPathRoot(path), StringComparison.CurrentCultureIgnoreCase));
if (driveInfo == null)
{ {
return 0; return 0;
} }
return DriveFreeSpaceEx(path); return driveInfo.AvailableFreeSpace;
} }
return driveInfo.AvailableFreeSpace; return DriveFreeSpaceEx(path);
} }
private static long DriveFreeSpaceEx(string folderName) private static long DriveFreeSpaceEx(string folderName)