Axle v0.14.1
Package

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

TypeMethod and description
bool
__pathIsSep(b : i32) : bool True when byte b is a path separator (/ or \).
bool
__pathIsAlpha(b : i32) : bool True when byte b is an ASCII letter (drive-prefix check).
string
__pathSlice(s : string, start : i64, end : i64) : string Copy bytes [start, end) of s into an owned string.
i64
__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.
string
__pathTrimEnd(s : string) : string Drop trailing separators, never shrinking below the root prefix.
i64
__pathLastSep(s : string) : i64 Index of the last separator byte in s, or -1.
string
__pathFileName(s : string) : string Final component of s (no directory prefix); "" for a pure root.
i64
__pathExtDot(name : string) : i64 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.
bool
__pathLastSegIsDotDot(joined : string) : bool True when the last /-joined segment of joined is ...
string
__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 ".".
ptr
__pathPtr(addr : i64) : ptr View an i64 address (FILE* handle or buffer base) as a ptr.
i64
__pathStreamId(s : ptr) : i64 Materialise a libc FILE* as an i64 (0 = open failure).
string
__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 / exe
keep from the native implementation.
void
__pathWriteAll(out : FileOutputStream, content : string) : void Emit a string's UTF-8 bytes to an open output stream in one
writeBytes. Shared by Path::writeText / Path::appendText; the
caller owns opening and closing out.

Method detail

#__pathIsSep

__pathIsSep(b : i32) : bool

True when byte b is a path separator (/ or \).

#__pathIsAlpha

__pathIsAlpha(b : i32) : bool

True when byte b is an ASCII letter (drive-prefix check).

#__pathSlice

__pathSlice(s : string, start : i64, end : i64) : string

Copy bytes [start, end) of s into an owned string.

#__pathRootLen

__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

__pathTrimEnd(s : string) : string

Drop trailing separators, never shrinking below the root prefix.

#__pathLastSep

__pathLastSep(s : string) : i64

Index of the last separator byte in s, or -1.

#__pathFileName

__pathFileName(s : string) : string

Final component of s (no directory prefix); "" for a pure root.

#__pathExtDot

__pathExtDot(name : string) : i64

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

__pathLastSegIsDotDot(joined : string) : bool

True when the last /-joined segment of joined is ...

#__pathNormalize

__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

__pathPtr(addr : i64) : ptr

View an i64 address (FILE* handle or buffer base) as a ptr.

#__pathStreamId

__pathStreamId(s : ptr) : i64

Materialise a libc FILE* as an i64 (0 = open failure).

#__pathOsQuery

__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 / exe
keep from the native implementation.

Parameters
wantExe true → executable path, false → working directory

#__pathWriteAll

__pathWriteAll(out : FileOutputStream, content : string) : void ! IOException

Emit a string's UTF-8 bytes to an open output stream in one
writeBytes. Shared by Path::writeText / Path::appendText; the
caller owns opening and closing out.

Parameters
out open file stream positioned where the bytes go
content text whose bytes are written

C class Path

Constructors

TypeMethod 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

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

Method detail

#from

from(s : string) : Path

#cwd

cwd() : Path

#exe

exe() : Path

#parent

parent(self) : Path

#join

join(self, part : string) : Path

#fileName

fileName(self) : string

#extension

extension(self) : string

#stripExtension

stripExtension(self) : Path

#normalize

normalize(self) : Path

#isAbsolute

isAbsolute(self) : bool

#toString

toString(self) : string

#exists

exists(self) : bool

#isFile

isFile(self) : bool

#isDirectory

isDirectory(self) : bool

#size

size(self) : i64 ! IOException

#lastModified

lastModified(self) : i64 ! IOException

#readText

readText(self) : string ! IOException

#writeText

writeText(self, content : string) : void ! IOException

#appendText

appendText(self, content : string) : void ! IOException

#mkdir

mkdir(self) : void ! IOException

#mkdirs

mkdirs(self) : void ! IOException

#rename

rename(self, to : string) : void ! IOException

#copy

copy(self, to : string) : void ! IOException

#delete

delete(self) : void ! IOException