nx_path_v1.nx
buildroot/runtime/nx_path_v1.nx
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
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
structs
| none |
consts
| 28 | const PATH_ERR_SHORT: i64 = -1 |
functions
| 31 | func path_last_slash(path: *u8, n: i64) -> i64 |
| 42 | func path_trim_trailing(path: *u8, n: i64) -> i64 |
| 53 | func path_basename(path: *u8, n: i64, |
| 77 | func path_dirname(path: *u8, n: i64, |
| 109 | func path_extension(path: *u8, n: i64, |
| 133 | func path_is_absolute(path: *u8, n: i64) -> i64 |
| 141 | func path_join(a: *u8, a_len: i64, |
| 175 | func main() -> i64 |