Skip to content

Commit

Permalink
Also create symlinks when running on Windows (#105)
Browse files Browse the repository at this point in the history
Co-authored-by: Erin Melucci <emelucci@opera.com>
  • Loading branch information
Jake-Shadle and sykhro authored Nov 7, 2023
1 parent eee7f11 commit dd52653
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 dd52653

Please sign in to comment.