Skip to content
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

Better docs for std::os::windows::fs::{symlink_dir, symlink_file}; #88635

Closed
matklad opened this issue Sep 4, 2021 · 3 comments · Fixed by #88647
Closed

Better docs for std::os::windows::fs::{symlink_dir, symlink_file}; #88635

matklad opened this issue Sep 4, 2021 · 3 comments · Fixed by #88647
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@matklad
Copy link
Member

matklad commented Sep 4, 2021

At the moment (rustc 1.56.0-nightly (b7404c8 2021-09-03)) the docs for this two functions are identical, and the only difference is file/dir. As a developer with primarily unix background, I don't really understand why there are two functions, and when I should use one versus the other. It would be helpful if the docs explained windows/unix difference, or linked upstream docs.

@matklad matklad added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Sep 4, 2021
@matklad
Copy link
Member Author

matklad commented Sep 4, 2021

see also 3cc84ef

@ChrisDenton
Copy link
Member

ChrisDenton commented Sep 4, 2021

Yes this could be improved. In Windows filesystems everything is either a file or directory, it doesn't have a separate category for symlinks (although the std sometimes tries hard to pretend otherwise). Therefore a file symlink must point to a file and a directory symlink must point to a directory. Otherwise the symlink will be broken.

EDIT: The underlying function is CreateSymbolicLinkW, which could be linked from the docs.

@ChrisDenton
Copy link
Member

It should probably also be documented that creating symlinks currently requires the user to enable developer mode (Win10 only) or have elevated privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants