path.nx
buildroot/runtime/path.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: 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
| 22 | const PATH_ERR_SHORT: i64 = -1 |
functions
| 25 | func path_last_slash(path: *u8, n: i64) -> i64 { |
| 36 | func path_trim_trailing(path: *u8, n: i64) -> i64 { |
| 47 | func path_basename(path: *u8, n: i64, |
| 71 | func path_dirname(path: *u8, n: i64, |
| 103 | func path_extension(path: *u8, n: i64, |
| 127 | func path_is_absolute(path: *u8, n: i64) -> i64 { |
| 135 | func path_join(a: *u8, a_len: i64, |
| 169 | func main() -> i64 { |