2 releases
0.1.1 | Apr 27, 2019 |
---|---|
0.1.0 | Apr 6, 2019 |
#1041 in Filesystem
64KB
955 lines
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))?;
}
Dependencies
~87KB