diff --git a/NzbDrone.Common/DiskProvider.cs b/NzbDrone.Common/DiskProvider.cs index cb15a672f..cf88f96f3 100644 --- a/NzbDrone.Common/DiskProvider.cs +++ b/NzbDrone.Common/DiskProvider.cs @@ -294,25 +294,25 @@ public long GetAvilableSpace(string path) { Ensure.That(() => path).IsValidPath(); + if (OsInfo.IsLinux) + { + var driveInfo = DriveInfo.GetDrives().SingleOrDefault(c => c.IsReady && path.StartsWith(c.Name, StringComparison.CurrentCultureIgnoreCase)); + + if (driveInfo == null) + { + throw new DirectoryNotFoundException(path); + } + + return driveInfo.AvailableFreeSpace; + } + 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)); - - if (driveInfo == null) - { - return 0; - } - - return driveInfo.AvailableFreeSpace; - } - return DriveFreeSpaceEx(root); - } + } private static long DriveFreeSpaceEx(string folderName) { diff --git a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs b/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs similarity index 94% rename from NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs rename to NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs index 9ae177c51..aa6d29a73 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests { [TestFixture] - public class FreeDiskSpaceTest : CoreTest + public class FreeDiskSpaceFixture : CoreTest { [Test] public void should_return_free_disk_space()