Skip to content

Windows: Use junctions rather than symlinks #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2021

Conversation

davidaurelio
Copy link
Contributor

@davidaurelio davidaurelio commented Aug 20, 2021

On windows, creating symlinks requires special privileges.

These privileges are typically either assigned by activating windows’s “Developer Mode” or via security policies.

This makes using fnm more difficult for beginners and people on managed machines, where developer mode might not include the right to create symlinks, and local security policies are reset on a regular basis.

NTFS offers an alternative mechanism. Junctions can be created without special privileges.

superuser.com has some more extensive answers on the differences between directory symlinks and junctions. The relevant difference for fnm is that symlinks can work across network drives, whereas junctions only work locally. This shouldn’t matter for fnm’s functionality.

By switching to directory junctions, fnm becomes easier to work with on windows, especially under circumstances where privileges to create symlinks cannot be assigned permanently.

This change is backwards compatible: Since both directory symlinks and junctions are removed using std::fs::remove_dir, an fnm upgrade will keep working with existing setups.

On windows, creating symlinks requires special privileges.

These privileges are typically either assigned by activating windows’s “Developer Mode” or via security policies.

This makes using _fnm_ more difficult for beginners and people on managed machines, where developer mode might not include the right to create symlinks, and local security policies are reset on a regular basis.

NTFS offers an alternative mechanism. Junctions can be **created without special privileges.**

[superuser.com] has some more extensive answers on the differences between directory symlinks and junctions. The relecant difference for fnm is that symlinks can work across network drives, whereas junctions only work locally. This shouldn’t matter for fnm’s functionality.

By switching to directory junctions, fnm becomes easier to work with on windows, especially under circumstances where privileges to create symlinks cannot be assigned permanently.

This change is backwards compatible: Since both directory symlinks and junctions are removed using `std::fs::remove_dir`, an fnm upgrade will keep working with existing setups.

[Directory Junctions]: https://docs.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions#junctions
[superuser.com]: https://superuser.com/questions/343074/directory-junction-vs-directory-symbolic-link
@vercel
Copy link

vercel bot commented Aug 20, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/schniz/fnm/A47nf8Numoifgc4Gy5KiXabGziFC
✅ Preview: https://fnm-git-fork-davidaurelio-win-junctions-not-symlinks-schniz.vercel.app

@Schniz
Copy link
Owner

Schniz commented Aug 20, 2021

Woah!!! Sounds amazing. Let's see that the tests pass. 💯💯💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: New Feature A new feature was added
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants