Skip to content

Commit 6792d46

Browse files
committed
fix(utils): unlink input path in delete_dir_contents() if it's a link
1 parent 3f57299 commit 6792d46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/utils.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,12 @@ where
611611
}
612612

613613
pub(crate) fn delete_dir_contents(dir_path: &Path) {
614-
match remove_dir_all::remove_dir_contents(dir_path) {
614+
let remove = if dir_path.is_symlink() {
615+
fs::remove_dir_all
616+
} else {
617+
remove_dir_all::remove_dir_contents
618+
};
619+
match remove(dir_path) {
615620
Err(e) if e.kind() != io::ErrorKind::NotFound => {
616621
panic!("Unable to clean up {}: {:?}", dir_path.display(), e);
617622
}

0 commit comments

Comments
 (0)