Skip to content

Commit

Permalink
replace remove_dir with remove_dir_all in helpers::symlink_dir
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
onur-ozkan committed Jun 18, 2024
1 parent e794b0f commit f76c3b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bootstrap/src/utils/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down

0 comments on commit f76c3b7

Please sign in to comment.