replace remove_dir with remove_dir_all in helpers::symlink_dir

When using `symlink_dir`, it first removes the existing link with `remove_dir`.
However, if the path isn't a link and contains files, `remove_dir` fails
with "DirectoryNotEmpty", which causes the symbolic linking to fail as well.
We have this problem on linking 'rustlib/rust' because it contains files as an
actual directory.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan
2024-06-17 22:43:44 +03:00
parent e794b0f855
commit f76c3b7fb9
+1 -1
View File
@@ -135,7 +135,7 @@ pub fn symlink_dir(config: &Config, original: &Path, link: &Path) -> io::Result<
if config.dry_run() {
return Ok(());
}
let _ = fs::remove_dir(link);
let _ = fs::remove_dir_all(link);
return symlink_dir_inner(original, link);
#[cfg(not(windows))]