code wiki / (root) / path.nx

path.nx

buildroot/runtime/path.nx

6559 B219 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic path
docsdependenciesstructsconstsfunctions

about

path.nx -- POSIX filesystem path manipulation. Same operations as Python's posixpath / Node's path.posix / Go's filepath: join / dirname / basename / extension / clean / absolute-check. Byte-oriented (not Unicode-aware), which matches how filesystems actually work. Forward-slash separator only. Windows backslashes fall outside the sovereign-Linux target (Milk-V Pioneer + NishiOS). Invariants: P1 Zero-alloc when possible: offsets into caller's buffer for basename/dirname/extension. Only `path_join` writes into a fresh output buffer. P2 Empty-path handling matches POSIX: dirname(\"\")=\".\" basename(\"\")=\"\" extension(\"\")=\"\". P3 Trailing slashes: dirname(\"/a/b/\")=\"/a\" matches POSIX; basename(\"/a/b/\")=\"b\" after trim.

dependencies 1 imports · 0 importers

syscalls.nx path.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main path_basename path_trim_trailing path_last_slash path_dirname path_trim_trailing ↻ path_last_slash ↻ path_extension path_basename ↻ path_is_absolute path_join path_is_absolute ↻

structs

none

consts

22const PATH_ERR_SHORT: i64 = -1

functions

25func path_last_slash(path: *u8, n: i64) -> i64 {
36func path_trim_trailing(path: *u8, n: i64) -> i64 {
47func path_basename(path: *u8, n: i64,
71func path_dirname(path: *u8, n: i64,
103func path_extension(path: *u8, n: i64,
called by 1: main calls 1: path_basename
127func path_is_absolute(path: *u8, n: i64) -> i64 {
called by 2: path_joinmain
135func path_join(a: *u8, a_len: i64,
called by 1: main calls 1: path_is_absolute
169func main() -> i64 {