1
0
mirror of https://github.com/containers/youki synced 2024-09-27 22:49:57 +02:00

Provide context in case of errors during dir creation

This commit is contained in:
Furisto 2021-07-01 22:25:23 +02:00
parent 8a13f82cd5
commit 9e7b13c7c2

View File

@ -96,6 +96,11 @@ pub fn write_file<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> Resul
Ok(())
}
pub fn create_dir_all<P: AsRef<Path>>(path: P) -> Result<()> {
let path = path.as_ref();
fs::create_dir_all(path).with_context(|| format!("failed to create directory {:?}", path))
}
pub struct TempDir {
path: Option<PathBuf>,
}