]> git.lizzy.rs Git - rust.git/commitdiff
std: win: Don't expose link() on UWP
authorHugo Beauzée-Luyssen <hugo@beauzee.fr>
Mon, 27 May 2019 14:44:06 +0000 (16:44 +0200)
committerHugo Beauzée-Luyssen <hugo@beauzee.fr>
Thu, 25 Jul 2019 19:30:08 +0000 (21:30 +0200)
Or rather expose it, but always return an error

src/libstd/sys/windows/c.rs
src/libstd/sys/windows/fs.rs

index 2cec96e0016a537d25726bc6a5865eef450c7dad..05fff046b652b811b18938bf4666613acea6ea7d 100644 (file)
@@ -667,6 +667,10 @@ pub struct timeval {
         pub fn SetHandleInformation(hObject: HANDLE,
                                     dwMask: DWORD,
                                     dwFlags: DWORD) -> BOOL;
+        pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
+                               lpTargetFileName: LPCWSTR,
+                               lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
+                               -> BOOL;
     }
 }
 }
@@ -883,10 +887,6 @@ pub fn WriteFile(hFile: HANDLE,
                      lpOverlapped: LPOVERLAPPED)
                      -> BOOL;
     pub fn CloseHandle(hObject: HANDLE) -> BOOL;
-    pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
-                           lpTargetFileName: LPCWSTR,
-                           lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
-                           -> BOOL;
     pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
                        lpNewFileName: LPCWSTR,
                        dwFlags: DWORD)
index d5cb205c85f5214c99dbf47c15dc46b00f1a074d..f6f64a008bbfe0945296a55ddd3b052dc96dbaf9 100644 (file)
@@ -670,6 +670,7 @@ pub fn symlink_inner(src: &Path, dst: &Path, dir: bool) -> io::Result<()> {
     Ok(())
 }
 
+#[cfg(not(target_vendor = "uwp"))]
 pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
     let src = to_u16s(src)?;
     let dst = to_u16s(dst)?;
@@ -679,6 +680,12 @@ pub fn link(src: &Path, dst: &Path) -> io::Result<()> {
     Ok(())
 }
 
+#[cfg(target_vendor = "uwp")]
+pub fn link(_src: &Path, _dst: &Path) -> io::Result<()> {
+    return Err(io::Error::new(io::ErrorKind::Other,
+                            "hard link are not supported on UWP"));
+}
+
 pub fn stat(path: &Path) -> io::Result<FileAttr> {
     let mut opts = OpenOptions::new();
     // No read or write permissions are necessary