mirror of https://github.com/lidarr/Lidarr
Fixing test issue when Linux always returns / for PathGetPathRoot (when its rooted)
http://typedescriptor.net/browse/members/1247454-Mono.Unix.UnixPath.GetPathRoot%28String%29
This commit is contained in:
parent
3559d35d92
commit
6b30d831b3
|
@ -294,23 +294,23 @@ namespace NzbDrone.Common
|
|||
{
|
||||
Ensure.That(() => path).IsValidPath();
|
||||
|
||||
var root = GetPathRoot(path);
|
||||
|
||||
if (!FolderExists(root))
|
||||
throw new DirectoryNotFoundException(root);
|
||||
|
||||
if (OsInfo.IsLinux)
|
||||
{
|
||||
var driveInfo = DriveInfo.GetDrives().SingleOrDefault(c => c.IsReady && c.Name.Equals(root, StringComparison.CurrentCultureIgnoreCase));
|
||||
var driveInfo = DriveInfo.GetDrives().SingleOrDefault(c => c.IsReady && path.StartsWith(c.Name, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (driveInfo == null)
|
||||
{
|
||||
return 0;
|
||||
throw new DirectoryNotFoundException(path);
|
||||
}
|
||||
|
||||
return driveInfo.AvailableFreeSpace;
|
||||
}
|
||||
|
||||
var root = GetPathRoot(path);
|
||||
|
||||
if (!FolderExists(root))
|
||||
throw new DirectoryNotFoundException(root);
|
||||
|
||||
return DriveFreeSpaceEx(root);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class FreeDiskSpaceTest : CoreTest<DiskProvider>
|
||||
public class FreeDiskSpaceFixture : CoreTest<DiskProvider>
|
||||
{
|
||||
[Test]
|
||||
public void should_return_free_disk_space()
|
Loading…
Reference in New Issue