Print path on metadata call failure

This commit is contained in:
Vincent Prouillet 2022-04-26 22:38:00 +02:00
parent c14b1fa746
commit 6851ade642
1 changed files with 3 additions and 1 deletions

View File

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