wasSharp
/IO.cs |
@@ -119,7 +119,7 @@ |
/// <param name="separator">the separator character</param> |
/// <param name="escape">the escape character</param> |
/// <returns>path parts</returns> |
public static IEnumerable<string> PathSplit(this string path, char separator, char? escape = null) |
public static IEnumerable<string> PathSplit(this string path, char separator, char? escape = null, bool includeRootSeparator = true) |
{ |
var s = new Stack<char>(); |
var p = new StringBuilder(); |
@@ -134,7 +134,7 @@ |
{ |
if (s.Count.Equals(0) || !s.Peek().Equals(escape)) |
{ |
if (p.Length.Equals(0)) |
if (p.Length.Equals(0) && includeRootSeparator) |
{ |
p.Append(c); |
continue; |