ironpath 0.1.1

An iron-hard crate for handling filesystem paths
Documentation

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

# fn foo() -> Result<(), Box<std::error::Error>> {
# use ironpath::*;
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))?;
}
# Ok(())
# }