Skip to content

std.path

pure path string ops; reads / and , writes SEP; builders take an *Arena

pub SEP :: 92u8

separator written by join and normalize

pub is_sep :: fn(c: u8) -> bool

either separator

pub basename :: fn(p: []const u8) -> []const u8

after the last separator; p if none, “” on a trailing separator

pub dirname :: fn(p: []const u8) -> []const u8

up to the last separator, trailing ones trimmed; “.” if none; a lone root stays

pub parent :: fn(p: []const u8) -> []const u8

alias of dirname

pub extension :: fn(p: []const u8) -> []const u8

includes the dot (“.txt”); “” if none; “.gitignore” has none

pub stem :: fn(p: []const u8) -> []const u8

basename minus extension

pub is_absolute :: fn(p: []const u8) -> bool

leading separator, \ UNC prefix, or X: drive

pub is_relative :: fn(p: []const u8) -> bool
pub has_extension :: fn(p: []const u8, want: []const u8) -> bool

leading dot in want optional

pub join :: fn(a: *Arena, x: []const u8, y: []const u8) -> []const u8

one SEP between; extra separators collapsed; an absolute y wins

pub join3 :: fn(a: *Arena, x: []const u8, y: []const u8, z: []const u8) -> []const u8
pub with_extension :: fn(a: *Arena, p: []const u8, new_ext: []const u8) -> []const u8

leading dot optional; “” removes the extension

pub normalize :: fn(a: *Arena, p: []const u8) -> []const u8

lexical clean-up: drops ., doubled seps and x/..; writes SEP; empty -> “.” no disk access, so .. past a symlink is lexical; leading .. kept, root .. dropped