Path.isRoot

Check if current path is root (does not have parent)

struct Path
@safe pure const
bool
isRoot
()

Examples

Posix

import dshould;
Path("/").isRoot.should.be(true);
Path("/some-dir").isRoot.should.be(false);
Path("local").isRoot.should.be(false);
Path("").isRoot.should.be(false);

Windows

import dshould;
Path(r"C:\").isRoot.should.be(true);
Path(r"D:\").isRoot.should.be(true);
Path(r"D:\some-dir").isRoot.should.be(false);
Path(r"\").isRoot.should.be(true);
Path(r"\local").isRoot.should.be(false);
Path("").isRoot.should.be(false);

Meta