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.isRooted
Determines whether a path
starts at a root directory.
On POSIX, this function returns true if and only if the path
starts
with a slash (/).
version (Posix) { assert (isRooted("/")); assert (isRooted("/foo")); assert (!isRooted("foo")); assert (!isRooted("../foo")); }
On Windows, this function returns true if the path
starts at
the root directory of the current drive, of some other drive,
or of a network drive.
version (Windows) { assert (isRooted(\
)); assert (isRooted(\foo
)); assert (isRooted(d:\foo
)); assert (isRooted(\\foo\bar
)); assert (!isRooted("foo")); assert (!isRooted("d:foo")); }
Prototype
bool isRooted(R)( R path ) if (isRandomAccessRange!R && isSomeChar!(ElementType!R) || is(StringTypeOf!R));
Authors
Lars Tandle Kyllingstad, Walter Bright, Grzegorz Adam Hankiewicz, Thomas Kühne, Andrei Alexandrescu