mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
Speedier unmapped folders lookup.
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
<Compile Include="Exceptions\NzbDroneException.cs" />
|
||||
<Compile Include="Instrumentation\GlobalExceptionHandlers.cs" />
|
||||
<Compile Include="Instrumentation\ExceptronTarget.cs" />
|
||||
<Compile Include="PathEqualityComparer.cs" />
|
||||
<Compile Include="TPL\LimitedConcurrencyLevelTaskScheduler.cs" />
|
||||
<Compile Include="Security\IgnoreCertErrorPolicy.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
public class PathEqualityComparer : IEqualityComparer<String>
|
||||
{
|
||||
public bool Equals(string x, string y)
|
||||
{
|
||||
return x.PathEquals(y);
|
||||
}
|
||||
|
||||
public int GetHashCode(string obj)
|
||||
{
|
||||
return obj.CleanFilePath().GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,12 @@ namespace NzbDrone.Common
|
||||
return info.FullName.TrimEnd('/').Trim('\\', ' ');
|
||||
}
|
||||
|
||||
|
||||
public static bool PathEquals(this string firstPath, string secondPath)
|
||||
{
|
||||
Ensure.That(() => firstPath).IsValidPath();
|
||||
Ensure.That(() => secondPath).IsValidPath();
|
||||
if (OsInfo.IsLinux)
|
||||
{
|
||||
return String.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath());
|
||||
}
|
||||
|
||||
return String.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath(), StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user