mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Free disk space check on Linux will use best match
Fixed: Better disk space check on Linux
This commit is contained in:
parent
2183526a34
commit
5c2073b297
@ -303,25 +303,23 @@ public void InheritFolderPermissions(string filename)
|
||||
{
|
||||
var drives = DriveInfo.GetDrives();
|
||||
|
||||
foreach (var drive in drives)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
if (drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
return drive.AvailableFreeSpace;
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Logger.ErrorException("Couldn't get free space for " + path, e);
|
||||
}
|
||||
return
|
||||
drives.Where(drive =>
|
||||
drive.IsReady && path.StartsWith(drive.Name, StringComparison.CurrentCultureIgnoreCase))
|
||||
.OrderByDescending(drive => drive.Name.Length)
|
||||
.First()
|
||||
.AvailableFreeSpace;
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Logger.ErrorException("Couldn't get free space for " + path, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return DriveFreeSpaceEx(root);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user