Browse Source

Add warning to symlink creation (#584)

remotes/origin/add-with-shims
Gal Schlezinger 3 years ago committed by GitHub
parent
commit
6816ff292c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/path_ext.rs

6
src/path_ext.rs

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
use log::warn;
pub trait PathExt {
fn ensure_exists_silently(self) -> Self;
}
@ -6,7 +8,9 @@ impl<T: AsRef<std::path::Path>> PathExt for T { @@ -6,7 +8,9 @@ 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();
if let Err(err) = std::fs::create_dir_all(self.as_ref()) {
warn!("Failed to create directory {:?}: {}", self.as_ref(), err);
}
self
}
}

Loading…
Cancel
Save