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)?;