Browse Source

Windows: Use junctions rather than symlinks (#519)

remotes/origin/add-with-shims
David Aurelio 4 years ago committed by GitHub
parent
commit
4a39428c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      Cargo.lock
  2. 1
      Cargo.toml
  3. 10
      README.md
  4. 2
      src/fs.rs

11
Cargo.lock generated

@ -458,6 +458,7 @@ dependencies = [ @@ -458,6 +458,7 @@ dependencies = [
"env_logger",
"indoc",
"insta",
"junction",
"log",
"pretty_assertions",
"reqwest",
@ -763,6 +764,16 @@ dependencies = [ @@ -763,6 +764,16 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "junction"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be39922b087cecaba4e2d5592dedfc8bda5d4a5a1231f143337cca207950b61d"
dependencies = [
"scopeguard",
"winapi",
]
[[package]]
name = "lazy_static"
version = "1.4.0"

1
Cargo.toml

@ -42,3 +42,4 @@ embed-resource = "1.6.3" @@ -42,3 +42,4 @@ embed-resource = "1.6.3"
[target.'cfg(windows)'.dependencies]
csv = "1.1.6"
junction = "0.2.0"

10
README.md

@ -139,16 +139,6 @@ fnm env | source @@ -139,16 +139,6 @@ fnm env | source
#### PowerShell
Before adding any configuration to your shell, you'd need to enable symlink support for a standard accounts (non-administrator).
You can do it by enabling [Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development), or [updating the Local Security Policy](#local-security-policy).
##### Local Security Policy
Open `Local Security Policy` (`secpol.msc`) and go to `Local Policies` -> `User Rights Assignment`, select `Create symbolic links`, add your user to the list and **reboot**.
> Use `whoami` if you are not sure what's your user name.
Add the following to the end of your profile file:
```powershell

2
src/fs.rs

@ -8,7 +8,7 @@ pub fn symlink_dir<P: AsRef<Path>, U: AsRef<Path>>(from: P, to: U) -> std::io::R @@ -8,7 +8,7 @@ pub fn symlink_dir<P: AsRef<Path>, U: AsRef<Path>>(from: P, to: U) -> std::io::R
#[cfg(windows)]
pub fn symlink_dir<P: AsRef<Path>, U: AsRef<Path>>(from: P, to: U) -> std::io::Result<()> {
std::os::windows::fs::symlink_dir(from, to)?;
junction::create(from, to)?;
Ok(())
}

Loading…
Cancel
Save