From 0b1bb3638822a489dea3df236299bbab8793c63f Mon Sep 17 00:00:00 2001 From: Michael Diamond Date: Fri, 19 Nov 2021 10:40:55 -0800 Subject: [PATCH] Improve error message when Windows rejects symlink creation, reference #3 --- src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7e7edd1..7f9bde6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -371,7 +371,10 @@ struct CacheEntry { // See https://doc.rust-lang.org/std/fs/fn.soft_link.html #[cfg(windows)] -use std::os::windows::fs::symlink_file as symlink; +fn symlink, Q: AsRef>(original: P, link: Q) -> Result<()> { + std::os::windows::fs::symlink_file(original, link) + .context("Windows prevents most programs from creating symlinks; see https://github.com/dimo414/bkt/issues/3") +} #[cfg(unix)] use std::os::unix::fs::symlink;