Skip to content

std.path - ZZ

Pure-ZZ lexical path helpers. No I/O — pure string manipulation, OS-aware separator style. Mirrors std.fs path functions for backward compatibility.

import std.path

std.path resolves, joins, and inspects paths without touching the disk. Separator style follows std.env.os() ("windows" → \, else /). Use for building paths before passing them to std.fs.

import std.path
path.join("a", "b.txt") // a/b.txt (+ normalize)
path.join_all(["a", "b", "c"]) // a/b/c
path.normalize("a/./b/../c") // a/c
path.basename("a/b.txt") // b.txt
path.dirname("a/b.txt") // a
path.is_absolute("/x") // true (also C:\x, \\unc\…)
path.extension("a.tar.gz") // gz (no dot)

path.join(a, b) normalizes: b wins when absolute — join(dir, "f.txt"), not join(dir, "/f.txt").

7 entries. Signatures come from the compiler’s own FuncSig table, so they match the runtime exactly; descriptions come from the module guide.

Function Signature Description
std.path.basename basename(path: str) -> str Final segment
std.path.dirname dirname(path: str) -> str Directory part
std.path.extension extension(path: str) -> str Extension without dot
std.path.is_absolute is_absolute(path: str) -> bool Rooted (/x, C:\x, \unc\…)
std.path.join join(a: str, b: str) -> str Join + normalize (b wins if absolute)
std.path.join_all join_all(parts: [str]) -> str Join many parts
std.path.normalize normalize(path: str) -> str Lexical normalize (./.., roots)
  • std.env — Environment variables and the surrounding host environment.
  • std.args — argv access and the flag parser: booleans, integers, strings and subcommands.
  • std.process — Spawning, waiting on and signalling child processes.
  • std.log — Log levels, sinks and spans for structured logging.
  • std.sys — Infallible machine information: OS, CPU, memory and uptime.
  • std.cell — Shared mutable slots for lock-free hand-off between green threads.

Full index: API reference · Standard library