diff --git a/src/api/sync.rs b/src/api/sync.rs index f004e71..cf3b482 100644 --- a/src/api/sync.rs +++ b/src/api/sync.rs @@ -237,14 +237,15 @@ fn symlink_or_rename(src: &Path, dst: &Path) -> Result<(), std::io::Error> { let src = make_relative(src, dst); #[cfg(target_os = "windows")] - std::os::windows::fs::symlink_file(src, dst)?; + { + if let Err(err) = std::os::windows::fs::symlink_file(src, dst) { + std::fs::rename(src, dst)?; + } + } #[cfg(target_family = "unix")] std::os::unix::fs::symlink(src, dst)?; - #[cfg(not(any(target_family = "unix", target_os = "windows")))] - std::fs::rename(src, dst)?; - Ok(()) } diff --git a/src/api/tokio.rs b/src/api/tokio.rs index 584b694..ae4a411 100644 --- a/src/api/tokio.rs +++ b/src/api/tokio.rs @@ -243,14 +243,15 @@ fn symlink_or_rename(src: &Path, dst: &Path) -> Result<(), std::io::Error> { let src = make_relative(src, dst); #[cfg(target_os = "windows")] - std::os::windows::fs::symlink_file(src, dst)?; + { + if let Err(err) = std::os::windows::fs::symlink_file(src, dst) { + std::fs::rename(src, dst)?; + } + } #[cfg(target_family = "unix")] std::os::unix::fs::symlink(src, dst)?; - #[cfg(not(any(target_family = "unix", target_os = "windows")))] - std::fs::rename(src, dst)?; - Ok(()) }