fio/path

Values

pub fn base_name(path: String) -> String

Get the base name (filename) of a path.

pub fn directory_name(path: String) -> String

Get the directory portion of a path.

pub fn expand(path: String) -> Result(String, Nil)

Expand/normalize a path, resolving . and .. segments. Returns Error(Nil) if .. would go above the root.

pub fn extension(path: String) -> Result(String, Nil)

Get the file extension (without dot).

pub fn is_absolute(path: String) -> Bool

Check if a path is absolute.

pub fn join(left: String, right: String) -> String

Join two path segments.

pub fn join_all(segments: List(String)) -> String

Join a list of path segments.

pub fn safe_relative(path: String) -> Result(String, Nil)

Validate that a path is a safe relative path (does not escape root).

This is primarily intended for sanitizing user-provided paths. On Windows, backslashes are treated as separators and are normalized to forward slashes.

pub fn split(path: String) -> List(String)

Split a path into its segments.

pub fn stem(path: String) -> String

Get the stem (filename without extension).

pub fn strip_extension(path: String) -> String

Remove the extension from a path.

pub fn with_extension(path: String, ext: String) -> String

Change the extension of a path.

Search Document