Path.anchor

string anchor() const @safe

Return the path anchor (drive + root on Windows; root on POSIX).

Platform semantics:

  • POSIX: anchor is "/" for absolute paths, empty otherwise.
  • Windows:
  • Drive absolute: "C:\\"; drive-relative: "C:".
  • UNC: "\\\\server\\share\\" (trailing backslash by convention, matching pathlib).
  • Root-only (no drive): "\\".

Returns

The anchor string, or empty if none.