diff --git a/NzbDrone.Common.Test/DiskProviderTests.cs b/NzbDrone.Common.Test/DiskProviderTests.cs index 4e841281d..978479444 100644 --- a/NzbDrone.Common.Test/DiskProviderTests.cs +++ b/NzbDrone.Common.Test/DiskProviderTests.cs @@ -94,6 +94,26 @@ public void MoveFolder_should_overright_existing_folder() VerifyMove(); } + + [TestCase(@"C:\", @"C:\")] + [TestCase(@"C:\\", @"C:\")] + [TestCase(@"c:\", @"C:\")] + [TestCase(@"c:\Test", @"C:\Test\\")] + [TestCase(@"c:\\\\\Test", @"C:\Test\\")] + [TestCase(@"c:\Test\\\\", @"C:\Test\\")] + [TestCase(@"c:\Test", @"C:\Test\\")] + public void paths_should_be_equeal(string first, string second) + { + DiskProvider.PathEquals(first, second).Should().BeTrue(); + } + + [TestCase(@"D:\Test", @"C:\Test\")] + [TestCase(@"D:\Test\Test", @"C:\TestTest\")] + public void paths_should_not_be_equeal(string first, string second) + { + DiskProvider.PathEquals(first, second).Should().BeFalse(); + } + private void VerifyCopy() { BinFolder.Refresh(); diff --git a/NzbDrone.Common/DiskProvider.cs b/NzbDrone.Common/DiskProvider.cs index 902f4b57f..d79d1c2e2 100644 --- a/NzbDrone.Common/DiskProvider.cs +++ b/NzbDrone.Common/DiskProvider.cs @@ -175,5 +175,11 @@ public virtual string ReadAllText(string filePath) { return File.ReadAllText(filePath); } + + + public static bool PathEquals(string firstPath, string secondPath) + { + return String.Equals(firstPath.NormalizePath(), secondPath.NormalizePath(), StringComparison.InvariantCultureIgnoreCase); + } } } \ No newline at end of file diff --git a/NzbDrone.Common/IISProvider.cs b/NzbDrone.Common/IISProvider.cs index 77012fc6a..e1bd23ea7 100644 --- a/NzbDrone.Common/IISProvider.cs +++ b/NzbDrone.Common/IISProvider.cs @@ -102,7 +102,7 @@ public virtual void StopServer() foreach (var process in _processProvider.GetProcessByName("IISExpress")) { Logger.Info("[{0}]IIS Process found. Path:{1}", process.Id, process.StartPath); - if (process.StartPath.NormalizePath() == _enviromentProvider.GetIISExe().NormalizePath()) + if (DiskProvider.PathEquals(process.StartPath, _enviromentProvider.GetIISExe())) { Logger.Info("[{0}]Process is considered orphaned.", process.Id); _processProvider.Kill(process.Id); diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index f89a4885a..9d8658522 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -218,7 +218,7 @@ public void nzbsorg_search_returns_valid_results(string title, int season, int e [TestCase("simpsons", 21, 23)] [TestCase("Hawaii Five-0 (2010)", 1, 1)] - [TestCase("In plain Sight", 1, 11)] + [TestCase("In plain Sight", 1, 11, Ignore = true)] public void newzbin_search_returns_valid_results(string title, int season, int episode) { var mocker = new AutoMoqer(); diff --git a/NzbDrone.Core/Providers/PostDownloadProvider.cs b/NzbDrone.Core/Providers/PostDownloadProvider.cs index be1a7bf2a..444b4af11 100644 --- a/NzbDrone.Core/Providers/PostDownloadProvider.cs +++ b/NzbDrone.Core/Providers/PostDownloadProvider.cs @@ -91,7 +91,7 @@ private void TagFolder(DirectoryInfo directory, PostDownloadStatusType status) { var target = GetTaggedFolderName(directory, status); - if (!String.Equals(target.NormalizePath(), directory.FullName.NormalizePath(), StringComparison.InvariantCultureIgnoreCase)) + if (!DiskProvider.PathEquals(target, directory.FullName)) { Logger.Warn("Unable to download [{0}]. Status: {1}",directory.Name, status); _diskProvider.MoveDirectory(directory.FullName, target); diff --git a/NzbDrone.Core/Providers/RootDirProvider.cs b/NzbDrone.Core/Providers/RootDirProvider.cs index 8d1a16517..ed3a9be47 100644 --- a/NzbDrone.Core/Providers/RootDirProvider.cs +++ b/NzbDrone.Core/Providers/RootDirProvider.cs @@ -72,11 +72,9 @@ public List GetUnmappedFolders(string path) foreach (string seriesFolder in _diskProvider.GetDirectories(path)) { - var cleanPath = new DirectoryInfo(seriesFolder).FullName.NormalizePath(); - - if (!_seriesProvider.SeriesPathExists(cleanPath)) + if (!_seriesProvider.SeriesPathExists(seriesFolder)) { - results.Add(cleanPath); + results.Add(seriesFolder.Normalize()); } } diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 5c2242b14..07f6a637e 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -179,9 +179,7 @@ public virtual void DeleteSeries(int seriesId) public virtual bool SeriesPathExists(string path) { - var normilizedPath = path.NormalizePath(); - - return GetAllSeries().Any(s => s.Path.NormalizePath() == normilizedPath); + return GetAllSeries().Any(s => DiskProvider.PathEquals(s.Path, path)); } public virtual List SearchForSeries(string title)