Skip to content
Snippets Groups Projects
Commit be092f37 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Create parent directories

parent eb2c0aaf
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,10 @@ pub fn install(config: Config) -> Result<(), String> {
($path:expr, $data:expr) => {{
let mut path = sysroot.clone();
path.push($path);
if let Some(parent) = path.parent() {
println!("Create file parent {}", parent.display());
fs::create_dir_all(parent).map_err(|err| format!("failed to create file parent {}: {}", parent.display(), err))?;
}
println!("Create file {}", path.display());
let mut file = fs::File::create(&path).map_err(|err| format!("failed to create {}: {}", path.display(), err))?;
file.write_all($data).map_err(|err| format!("failed to write {}: {}", path.display(), err))?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment