[][src]Crate ironpath

Cleaned-up cross-platform path handling

Most operating systems accept a complex syntax for specifying filesystem paths, including special notation for things like "the current directory" and "the parent directory" that make path-handling code intricate. If filesystem paths always described a straight-line path from the root to the file or directory in question, path-handling code could be much simpler.

This module contains types representing exactly those kinds of paths.

Examples

let install_structure = vec![
    Relative::new("bin")?,
    Relative::new("lib")?,
    Relative::new("share/applications")?,
    Relative::new("share/icons")?,
    Relative::new("share/man")?,
];

let raw_install_path = std::env::args_os().next().ok_or("missing arg")?;
let install_path = Absolute::new(raw_install_path)?;

for each in install_structure.iter() {
    std::fs::create_dir_all(install_path.join_relative(each))?;
}

Structs

Absolute

An absolute path that may or may not exist.

Relative

A relative path that may be joined to an absolute path.

Enums

Error

An error encountered during path handling.