You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

12 lines
372 B

pub trait PathExt {
fn ensure_exists_silently(self) -> Self;
}
impl<T: AsRef<std::path::Path>> PathExt for T {
/// Ensures a path is existing by creating it recursively
/// if it is missing. No error is emitted if the creation has failed.
fn ensure_exists_silently(self) -> Self {
std::fs::create_dir_all(self.as_ref()).ok();
self
}
}