Path.root

string root() const @safe

Return the root component of the path.

Platform semantics:

  • POSIX: "/" for absolute paths, otherwise empty.
  • Windows: "\\" for absolute paths (including UNC and "\\foo"), empty for drive-relative paths (e.g., "C:foo").

Returns

The root string or an empty string if not present.