Skip to content

Commit 8c03b14

Browse files
committed
libstd: win: Don't expose link() on UWP
1 parent 2ededc6 commit 8c03b14

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/libstd/sys/windows/c.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ extern "system" {
12151215
lpOverlapped: LPOVERLAPPED)
12161216
-> BOOL;
12171217
pub fn CloseHandle(hObject: HANDLE) -> BOOL;
1218+
#[cfg(not(target_os = "uwp"))]
12181219
pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
12191220
lpTargetFileName: LPCWSTR,
12201221
lpSecurityAttributes: LPSECURITY_ATTRIBUTES)

src/libstd/sys/windows/fs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ pub fn symlink_inner(src: &Path, dst: &Path, dir: bool) -> io::Result<()> {
710710
Ok(())
711711
}
712712

713+
#[cfg(not(target_os = "uwp"))]
713714
pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
714715
let src = to_u16s(src)?;
715716
let dst = to_u16s(dst)?;
@@ -719,6 +720,12 @@ pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
719720
Ok(())
720721
}
721722

723+
#[cfg(target_os = "uwp")]
724+
pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
725+
return Err(io::Error::new(io::ErrorKind::Other,
726+
"hard link are not supported on UWP"));
727+
}
728+
722729
pub fn stat(path: &Path) -> io::Result<FileAttr> {
723730
let mut opts = OpenOptions::new();
724731
// No read or write permissions are necessary

0 commit comments

Comments
 (0)