We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0ffef9 commit 6c34b71Copy full SHA for 6c34b71
src/utils/utils.rs
@@ -293,7 +293,15 @@ where
293
}
294
295
pub(crate) fn hard_or_symlink_file(src: &Path, dest: &Path) -> Result<()> {
296
- if hardlink_file(src, dest).is_err() {
+ // Some mac filesystems can do hardlinks to symlinks, some can't.
297
+ // See rust-lang/rustup#3136 for why it's better never to use them.
298
+ #[cfg(target_os = "macos")]
299
+ let force_symlink = fs::symlink_metadata(src)
300
+ .map(|m| m.file_type().is_symlink())
301
+ .unwrap_or(false);
302
+ #[cfg(not(target_os = "macos"))]
303
+ let force_symlink = false;
304
+ if force_symlink || hardlink_file(src, dest).is_err() {
305
symlink_file(src, dest)?;
306
307
Ok(())
0 commit comments