A path name.
A slice of path.
assert(rootName("") is null); assert(rootName("foo") is null); assert(rootName("/") == "/"); assert(rootName("/foo/bar") == "/"); version (Windows) { assert(rootName("d:foo") is null); assert(rootName(`d:\foo`) == `d:\`); assert(rootName(`\\server\share\foo`) == `\\server\share`); assert(rootName(`\\server\share`) == `\\server\share`); }
Returns the root directory of the specified path, or null if the path is not rooted.