From 3e65c393fdceb487dcb8ee397fe58dbf8fc3f34c Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 29 Aug 2013 19:10:43 -0700 Subject: [PATCH] fixed broken test --- NzbDrone.Common/PathExtensions.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Common/PathExtensions.cs b/NzbDrone.Common/PathExtensions.cs index b5e899eba..374d2372a 100644 --- a/NzbDrone.Common/PathExtensions.cs +++ b/NzbDrone.Common/PathExtensions.cs @@ -58,7 +58,15 @@ private static string GetProperCapitalization(DirectoryInfo dirInfo) //Drive letter return dirInfo.Name.ToUpper(); } - return Path.Combine(GetProperCapitalization(parentDirInfo), parentDirInfo.GetDirectories(dirInfo.Name)[0].Name); + + var folderName = dirInfo.Name; + + if (dirInfo.Exists) + { + folderName = parentDirInfo.GetDirectories(dirInfo.Name)[0].Name; + } + + return Path.Combine(GetProperCapitalization(parentDirInfo), folderName); } public static string GetActualCasing(this string path)