|
|
|
@ -301,16 +301,9 @@ namespace NzbDrone.Common
|
|
|
|
|
|
|
|
|
|
if (OsInfo.IsLinux)
|
|
|
|
|
{
|
|
|
|
|
var drives = DriveInfo.GetDrives();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
return
|
|
|
|
|
drives.Where(drive =>
|
|
|
|
|
drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.OrderByDescending(drive => drive.Name.Length)
|
|
|
|
|
.First()
|
|
|
|
|
.AvailableFreeSpace;
|
|
|
|
|
return GetDriveInfoLinux(path).AvailableFreeSpace;
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidOperationException e)
|
|
|
|
|
{
|
|
|
|
@ -468,28 +461,19 @@ namespace NzbDrone.Common
|
|
|
|
|
throw new DirectoryNotFoundException(root);
|
|
|
|
|
|
|
|
|
|
if (OsInfo.IsLinux)
|
|
|
|
|
{
|
|
|
|
|
var drives = DriveInfo.GetDrives();
|
|
|
|
|
|
|
|
|
|
foreach (var drive in drives)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return drive.TotalSize;
|
|
|
|
|
}
|
|
|
|
|
return GetDriveInfoLinux(path).TotalFreeSpace;
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidOperationException e)
|
|
|
|
|
{
|
|
|
|
|
Logger.ErrorException("Couldn't get total space for " + path, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DriveTotalSizeEx(root);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -552,5 +536,16 @@ namespace NzbDrone.Common
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DriveInfo GetDriveInfoLinux(string path)
|
|
|
|
|
{
|
|
|
|
|
var drives = DriveInfo.GetDrives();
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
drives.Where(drive =>
|
|
|
|
|
drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
.OrderByDescending(drive => drive.Name.Length)
|
|
|
|
|
.First();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|