From dd52653c33ddde8b69888b9d75cdb4c31219b4f9 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Tue, 7 Nov 2023 08:42:31 +0100 Subject: [PATCH] Also create symlinks when running on Windows (#105) Co-authored-by: Erin Melucci --- src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index e6007d5..e371654 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)]