View source code
Display the source code in std/path.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.path.rootName
Returns the root directory of the specified path
, or null
if the
path
is not rooted.
Prototype
auto rootName(R)( R path ) if (isRandomAccessRange!R && hasSlicing!R && hasLength!R && isSomeChar!(ElementType!R) || is(StringTypeOf!R));
Parameters
Name | Description |
---|---|
path | filespec |
Returns
slice of path
Examples
assert (rootName("foo") is null); assert (rootName("/foo") == "/"); version (Windows) { assert (rootName(\foo
) ==\
); assert (rootName(c:\foo
) ==c:\
); assert (rootName(\\server\share\foo
) ==\\server\share
); }
Authors
Lars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Kühne, Andrei Alexandrescu