mirror of https://github.com/Radarr/Radarr
Fixed: Total free space on Linux
This commit is contained in:
parent
018b898a46
commit
9fcd422f29
|
@ -301,16 +301,9 @@ namespace NzbDrone.Common
|
||||||
|
|
||||||
if (OsInfo.IsLinux)
|
if (OsInfo.IsLinux)
|
||||||
{
|
{
|
||||||
var drives = DriveInfo.GetDrives();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return
|
return GetDriveInfoLinux(path).AvailableFreeSpace;
|
||||||
drives.Where(drive =>
|
|
||||||
drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
.OrderByDescending(drive => drive.Name.Length)
|
|
||||||
.First()
|
|
||||||
.AvailableFreeSpace;
|
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException e)
|
catch (InvalidOperationException e)
|
||||||
{
|
{
|
||||||
|
@ -469,27 +462,18 @@ namespace NzbDrone.Common
|
||||||
|
|
||||||
if (OsInfo.IsLinux)
|
if (OsInfo.IsLinux)
|
||||||
{
|
{
|
||||||
var drives = DriveInfo.GetDrives();
|
try
|
||||||
|
|
||||||
foreach (var drive in drives)
|
|
||||||
{
|
{
|
||||||
try
|
return GetDriveInfoLinux(path).TotalFreeSpace;
|
||||||
{
|
}
|
||||||
if (drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
catch (InvalidOperationException e)
|
||||||
{
|
{
|
||||||
return drive.TotalSize;
|
Logger.ErrorException("Couldn't get total space for " + path, e);
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Couldn't get total space for " + path, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return DriveTotalSizeEx(root);
|
return DriveTotalSizeEx(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,5 +536,16 @@ namespace NzbDrone.Common
|
||||||
|
|
||||||
return 0;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue