From 6851ade6425a8d3cd639fe62d0ddb1ae228352b5 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 26 Apr 2022 22:38:00 +0200 Subject: [PATCH] Print path on metadata call failure --- components/utils/src/fs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/utils/src/fs.rs b/components/utils/src/fs.rs index 6cb031e7..fa2d83bb 100644 --- a/components/utils/src/fs.rs +++ b/components/utils/src/fs.rs @@ -88,7 +88,9 @@ pub fn copy_file_if_needed(src: &Path, dest: &Path, hard_link: bool) -> Result<( if hard_link { std::fs::hard_link(src, dest)? } else { - let src_metadata = metadata(src)?; + let src_metadata = metadata(src).with_context(|| { + format!("Failed to get metadata of {}", src.display()) + })?; let src_mtime = FileTime::from_last_modification_time(&src_metadata); if Path::new(&dest).is_file() { let target_metadata = metadata(&dest)?;