Skip to content

Commit de67138

Browse files
authored
GetDirectoryName fixed for path with no slash (#32)
1 parent 4905965 commit de67138

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

System.IO.FileSystem/Path.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ public static string GetDirectoryName(string path)
139139

140140
var lastPathPostion = path.LastIndexOf(DirectorySeparatorChar);
141141

142+
if (lastPathPostion == -1)
143+
{
144+
return string.Empty;
145+
}
146+
142147
return path.Substring(0, lastPathPostion);
143148
}
144149
}

0 commit comments

Comments
 (0)