code wiki / (root) / nx_path_v1.nx

nx_path_v1.nx

buildroot/runtime/nx_path_v1.nx

6594 B225 linesdepth 2pulls 2 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

nx_syscalls.nx nx_path_v1.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

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

structs

none

consts

28const PATH_ERR_SHORT: i64 = -1

functions

31func path_last_slash(path: *u8, n: i64) -> i64
42func path_trim_trailing(path: *u8, n: i64) -> i64
53func path_basename(path: *u8, n: i64,
77func path_dirname(path: *u8, n: i64,
109func path_extension(path: *u8, n: i64,
called by 1: main calls 2: sys_mmappath_basename
133func path_is_absolute(path: *u8, n: i64) -> i64
called by 2: path_joinmain
141func path_join(a: *u8, a_len: i64,
called by 1: main calls 1: path_is_absolute
175func main() -> i64