Reference · reference

path module

1 min read · 2026-09-02 · config-weave 0.1.0

use path manipulates path strings without touching the filesystem. Every function is pure and uses the separator of the platform the script runs on. Only absolutize can fail, because it reads the current directory; it returns Result[string, string]. Use the fs module to read or write what a path names.

join

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

Joins two segments with the platform separator.

parent

rust
path::parent(p: string) -> string

Returns the parent directory of a path. At the root it returns the empty string.

filename

rust
path::filename(p: string) -> string

Returns the final component of a path.

extension

rust
path::extension(p: string) -> string

Returns the extension of the final component without the dot, or the empty string when there is none.

normalize

rust
path::normalize(p: string) -> string

Resolves . and .. components lexically. It does not consult the filesystem, so symlinks are not followed.

absolutize

rust
path::absolutize(p: string) -> Result[string, string]

Makes a path absolute against the current directory, then normalizes it.

rust
use path

let conf = path::join("/etc/app", "app.conf")
let ext = path::extension(conf)   // "conf"
let dir = path::parent(conf)      // "/etc/app"