std/io/path
std/path — file-system path, in pure Axle.Path is the single OO surface for file-system locations. It is a
regular heap class around a repr : string; methods chain —.parent(), .join(name) — and only round-trip through string
at the boundaries (.toString() for display, Path::from(s) to
construct from a literal).
The pure-name operations (parent / join / fileName /extension / normalize / …) are lexical string logic: both /
and \ are accepted as separators on input, / is emitted on
output, and a drive prefix (X:) counts as a root. File I/O rides
the ISO C stdio bindings (std/ffi/libc/fs), like std/io::File;
the stat / directory / process-path operations whose OS APIs
diverge ride the axle_rt_* runtime shims (std/ffi/runtime).
Free functions
| Type | Method and description |
|---|---|
| __pathIsSep(b : i32) : bool True when byte b is a path separator (/ or \). |
| __pathIsAlpha(b : i32) : bool True when byte b is an ASCII letter (drive-prefix check). |
| __pathSlice(s : string, start : i64, end : i64) : string Copy bytes [start, end) of s into an owned string. |
| __pathRootLen(s : string) : i64 Byte length of s's root prefix: 3 for X:/, 2 for a bare X:drive, 1 for a leading separator, 0 for a relative path. |
| __pathTrimEnd(s : string) : string Drop trailing separators, never shrinking below the root prefix. |
| __pathLastSep(s : string) : i64 Index of the last separator byte in s, or -1. |
| __pathFileName(s : string) : string Final component of s (no directory prefix); "" for a pure root. |
| __pathExtDot(name : string) : i64 Index of the extension dot inside file name name, or -1. The dotmust not be the first byte, so a dotfile ( .gitignore) carries noextension — matching Rust's Path::extension rule. |
| __pathLastSegIsDotDot(joined : string) : bool True when the last /-joined segment of joined is ... |
| __pathNormalize(s : string) : string Lexically normalize s: collapse . and redundant separators,pop a normal segment on .. (a .. that cannot pop is kept,including directly under a root). "" collapses to ".". |
| __pathPtr(addr : i64) : ptr View an i64 address (FILE* handle or buffer base) as a ptr. |
| __pathStreamId(s : ptr) : i64 Materialise a libc FILE* as an i64 (0 = open failure). |
| __pathOsQuery(wantExe : bool) : string Fill a fresh buffer from a runtime out-buffer shim and return the text, "" on shim failure — the empty-path fallback cwd / exekeep from the native implementation. |
| __pathWriteAll(out : FileOutputStream, content : string) : void Emit a string's UTF-8 bytes to an open output stream in onewriteBytes. Shared by Path::writeText / Path::appendText; thecaller owns opening and closing out. |
Method detail
#__pathIsSep
True when byte b is a path separator (/ or \).
#__pathIsAlpha
True when byte b is an ASCII letter (drive-prefix check).
#__pathSlice
Copy bytes [start, end) of s into an owned string.
#__pathRootLen
Byte length of s's root prefix: 3 for X:/, 2 for a bare X:
drive, 1 for a leading separator, 0 for a relative path.
#__pathTrimEnd
Drop trailing separators, never shrinking below the root prefix.
#__pathLastSep
Index of the last separator byte in s, or -1.
#__pathFileName
Final component of s (no directory prefix); "" for a pure root.
#__pathExtDot
Index of the extension dot inside file name name, or -1. The dot
must not be the first byte, so a dotfile (.gitignore) carries no
extension — matching Rust's Path::extension rule.
#__pathLastSegIsDotDot
True when the last /-joined segment of joined is ...
#__pathNormalize
Lexically normalize s: collapse . and redundant separators,
pop a normal segment on .. (a .. that cannot pop is kept,
including directly under a root). "" collapses to ".".
#__pathPtr
View an i64 address (FILE* handle or buffer base) as a ptr.
#__pathStreamId
Materialise a libc FILE* as an i64 (0 = open failure).
#__pathOsQuery
Fill a fresh buffer from a runtime out-buffer shim and return the
text, "" on shim failure — the empty-path fallback cwd / exe
keep from the native implementation.
wantExe true → executable path, false → working directory#__pathWriteAll
Emit a string's UTF-8 bytes to an open output stream in onewriteBytes. Shared by Path::writeText / Path::appendText; the
caller owns opening and closing out.
out open file stream positioned where the bytes gocontent text whose bytes are writtenC class Path
Constructors
| Type | Method and description |
|---|---|
| constructor() Zero-state instance — the receiver sema allocates for the static-style Path::from(..) / Path::cwd() / Path::exe()dispatch. The factories below produce the real value. |
Method detail
#constructor
Zero-state instance — the receiver sema allocates for the
static-style Path::from(..) / Path::cwd() / Path::exe()
dispatch. The factories below produce the real value.
Methods
| Type | Method and description |
|---|---|
| from(s : string) : Path |
| cwd() : Path |
| exe() : Path |
| parent(self) : Path |
| join(self, part : string) : Path |
| fileName(self) : string |
| extension(self) : string |
| stripExtension(self) : Path |
| normalize(self) : Path |
| isAbsolute(self) : bool |
| toString(self) : string |
| exists(self) : bool |
| isFile(self) : bool |
| isDirectory(self) : bool |
| size(self) : i64 |
| lastModified(self) : i64 |
| readText(self) : string |
| writeText(self, content : string) : void |
| appendText(self, content : string) : void |
| mkdir(self) : void |
| mkdirs(self) : void |
| rename(self, to : string) : void |
| copy(self, to : string) : void |
| delete(self) : void |