Skip to content

path

Pure-string path manipulation (no I/O).

Constants

sep

path::sep

Platform path separator — / on Unix, \ on Windows.

Functions

basename

path::basename(p) -> string

Final component of p.

components

path::components(p) -> list<string>

Split p into its components.

extension

path::extension(p) -> string

Extension of p without the leading dot. Empty string if none.

is_absolute

path::is_absolute(p) -> bool

True if p is absolute on the current platform.

is_relative

path::is_relative(p) -> bool

True if p is relative on the current platform.

join

path::join(a, b, ...) -> string

Variadic path join using the platform separator.

normalize

path::normalize(p) -> string

Lexically normalise p — collapse . and .. without consulting the filesystem.

parent

path::parent(p) -> string

Directory containing p. Empty string if p has no parent.

stem

path::stem(p) -> string

Basename of p with the extension stripped.

with_extension

path::with_extension(p, ext) -> string

Replace (or add) the extension on p.

Documentation reflects Ion v0.2.0-66-g3faa376.