Skip to content

Commit

Permalink
Also create symlinks when running on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sykhro authored and Jake-Shadle committed Nov 7, 2023
1 parent eee7f11 commit 87356e0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,13 @@ fn symlink(original: &str, link: &Path) -> Result<(), Error> {
}

#[cfg(windows)]
fn symlink(_original: &str, _link: &Path) -> Result<(), Error> {
Ok(())
fn symlink(original: &str, link: &Path) -> Result<(), Error> {
if std::fs::metadata(original)?.is_dir() {
std::os::windows::fs::symlink_dir(original, link)
} else {
std::os::windows::fs::symlink_file(original, link)
}
.with_context(|| format!("unable to symlink from {link} to {original}"))
}

#[cfg(test)]
Expand Down

0 comments on commit 87356e0

Please sign in to comment.