Skip to content

Commit 419c382

Browse files
committed
Use junctions for directory links on Windows
Using symlinks on Windows requires that our users enable Developer mode, which isn't always possible. For directory links, there is an easy solution: NTFS Junctions. These work the same as symlinks but do not require administrator privileges nor developer mode.
1 parent 4250c43 commit 419c382

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Cargo.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/volta-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ fs2 = "0.4.3"
5555

5656
[target.'cfg(windows)'.dependencies]
5757
winreg = "0.52.0"
58+
junction = "1.1.0"

crates/volta-core/src/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ where
138138
D: AsRef<Path>,
139139
{
140140
#[cfg(windows)]
141-
return std::os::windows::fs::symlink_dir(src, dest);
141+
return junction::create(src, dest);
142142

143143
#[cfg(unix)]
144144
return std::os::unix::fs::symlink(src, dest);

0 commit comments

Comments
 (0)