mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-16 15:29:40 +02:00
Merge remote branch 'scott/master'
This commit is contained in:
commit
ac1a8b4e50
@ -58,6 +58,7 @@ public void quality_parse(string path, object quality)
|
|||||||
[Row(@"c:\\test\\", @"c:\test")]
|
[Row(@"c:\\test\\", @"c:\test")]
|
||||||
[Row(@"C:\\Test\\", @"c:\test")]
|
[Row(@"C:\\Test\\", @"c:\test")]
|
||||||
[Row(@"C:\\Test\\Test\", @"c:\test\test")]
|
[Row(@"C:\\Test\\Test\", @"c:\test\test")]
|
||||||
|
[Row(@"\\Testserver\Test\", @"\\testserver\test")]
|
||||||
public void Normalize_Path(string dirty, string clean)
|
public void Normalize_Path(string dirty, string clean)
|
||||||
{
|
{
|
||||||
var result = Parser.NormalizePath(dirty);
|
var result = Parser.NormalizePath(dirty);
|
||||||
|
@ -130,11 +130,20 @@ internal static string NormalizeTitle(string title)
|
|||||||
return NormalizeRegex.Replace(title, String.Empty).ToLower();
|
return NormalizeRegex.Replace(title, String.Empty).ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Note: changing case on path is a problem for running on mono/*nix
|
||||||
public static string NormalizePath(string path)
|
public static string NormalizePath(string path)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(path))
|
if (String.IsNullOrEmpty(path))
|
||||||
throw new ArgumentException("Path can not be null or empty");
|
throw new ArgumentException("Path can not be null or empty");
|
||||||
return new FileInfo(path).FullName.ToLower().Trim('/', '\\', ' ');
|
|
||||||
|
var info = new FileInfo(path);
|
||||||
|
|
||||||
|
if( info.FullName.StartsWith(@"\\")) //UNC
|
||||||
|
{
|
||||||
|
return info.FullName.ToLower().TrimEnd('/', '\\', ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return info.FullName.ToLower().Trim('/', '\\', ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user