Skip to content

std/path

std/path — POSIX path manipulation (string-level, no FS interaction). POSIX separator (/) only; Windows paths aren’t a target right now (lang’s stated platforms are Linux + macOS + wasi-edge). Matches Go path/filepath (Unix mode) and Zig std.fs.path minimally. Functions: path_join(parts) — joins parts with single / between, collapses double separators. path_parent(p) — leading-everything before the last /; "" for paths with no separator. path_file_name(p) — last component. path_extension(p) — substring after the LAST . of the last component, or "" if none. A leading-dot file (.bashrc) has no extension. Migrated from the auto-injected prelude per docs/PRELUDE-TO-MODULES.md.

pub function path_join(parts: string[]): string
pub function path_parent(p: string): string
pub function path_file_name(p: string): string
pub function path_extension(p: string): string