Skip to content

Commit ea26272

Browse files
committed
clif: Provide better output messages for failed copies
1 parent e6d288b commit ea26272

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build_system/utils.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ pub(crate) fn copy_dir_recursively(from: &Path, to: &Path) {
213213
if filename == "." || filename == ".." {
214214
continue;
215215
}
216+
let src = from.join(&filename);
217+
let dst = to.join(&filename);
216218
if entry.metadata().unwrap().is_dir() {
217-
fs::create_dir(to.join(&filename)).unwrap();
218-
copy_dir_recursively(&from.join(&filename), &to.join(&filename));
219+
fs::create_dir(&dst).unwrap_or_else(|e| panic!("failed to create {dst:?}: {e}"));
220+
copy_dir_recursively(&src, &dst);
219221
} else {
220-
fs::copy(from.join(&filename), to.join(&filename)).unwrap();
222+
fs::copy(&src, &dst).unwrap_or_else(|e| panic!("failed to copy {src:?}->{dst:?}: {e}"));
221223
}
222224
}
223225
}

0 commit comments

Comments
 (0)