diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-29 10:41:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-29 10:41:33 +0100 |
| commit | 80277dcc4f39c7142c7217543b083ed6fd9919e8 (patch) | |
| tree | 0122824d20ff3db38f68a92ca1692460b494e8e8 /library/std/src | |
| parent | 9981e56d3b820f429fac62b4ff916f2a871340b4 (diff) | |
| parent | 9c3b0d81ef4ebcb1f1ca9d17bf222d832e513140 (diff) | |
| download | rust-80277dcc4f39c7142c7217543b083ed6fd9919e8.tar.gz rust-80277dcc4f39c7142c7217543b083ed6fd9919e8.zip | |
Rollup merge of #91049 - dimo414:patch-1, r=kennytm
Add a caveat to std::os::windows::fs::symlink_file This is similar to the note on [Python's `os.symlink()`](https://docs.python.org/3/library/os.html#os.symlink). Some additional notes in https://github.com/dimo414/bkt/issues/3.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/os/windows/fs.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs index be35ab0ca1e..31d1e3c1e42 100644 --- a/library/std/src/os/windows/fs.rs +++ b/library/std/src/os/windows/fs.rs @@ -543,6 +543,16 @@ impl FileTypeExt for fs::FileType { /// Ok(()) /// } /// ``` +/// +/// # Limitations +/// +/// Windows treats symlink creation as a [privileged action][symlink-security], +/// therefore this function is likely to fail unless the user makes changes to +/// their system to permit symlink creation. Users can try enabling Developer +/// Mode, granting the `SeCreateSymbolicLinkPrivilege` privilege, or running +/// the process as an administrator. +/// +/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links #[stable(feature = "symlink", since = "1.1.0")] pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> { sys::fs::symlink_inner(original.as_ref(), link.as_ref(), false) @@ -572,6 +582,16 @@ pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io: /// Ok(()) /// } /// ``` +/// +/// # Limitations +/// +/// Windows treats symlink creation as a [privileged action][symlink-security], +/// therefore this function is likely to fail unless the user makes changes to +/// their system to permit symlink creation. Users can try enabling Developer +/// Mode, granting the `SeCreateSymbolicLinkPrivilege` privilege, or running +/// the process as an administrator. +/// +/// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links #[stable(feature = "symlink", since = "1.1.0")] pub fn symlink_dir<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<()> { sys::fs::symlink_inner(original.as_ref(), link.as_ref(), true) |
