Fixed: NzbDrone running on Windows should no longer fail while getting a very long path from a sabnzbd running on linux.

This commit is contained in:
Taloth Saldono
2014-06-25 20:40:53 +02:00
parent 34edeac391
commit 839a2ac742
3 changed files with 36 additions and 3 deletions

View File

@@ -53,6 +53,22 @@ namespace NzbDrone.Common
return childPath.Substring(parentPath.Length).Trim(Path.DirectorySeparatorChar);
}
public static string GetParentPath(this string childPath)
{
var parentPath = childPath.TrimEnd('\\', '/');
var index = parentPath.LastIndexOfAny(new[] { '\\', '/' });
if (index != -1)
{
return parentPath.Substring(0, index);
}
else
{
return null;
}
}
public static bool IsParentPath(this string parentPath, string childPath)
{
parentPath = parentPath.TrimEnd(Path.DirectorySeparatorChar);