fio/path
Values
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 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 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.