From 6816ff292ca56b07992c8c99d011d60091855ee2 Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Tue, 30 Nov 2021 20:00:12 +0200 Subject: [PATCH] Add warning to symlink creation (#584) --- src/path_ext.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/path_ext.rs b/src/path_ext.rs index 7a5fea2..d87df44 100644 --- a/src/path_ext.rs +++ b/src/path_ext.rs @@ -1,3 +1,5 @@ +use log::warn; + pub trait PathExt { fn ensure_exists_silently(self) -> Self; } @@ -6,7 +8,9 @@ impl> 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 } }