| ... | @@ -1705,6 +1705,15 @@ pub fn symLink( | ... | @@ -1705,6 +1705,15 @@ pub fn symLink( |
| 1705 | var target_path_w: std.os.windows.PathSpace = undefined; | 1705 | var target_path_w: std.os.windows.PathSpace = undefined; |
| 1706 | target_path_w.len = try std.unicode.wtf8ToWtf16Le(&target_path_w.data, target_path); | 1706 | target_path_w.len = try std.unicode.wtf8ToWtf16Le(&target_path_w.data, target_path); |
| 1707 | target_path_w.data[target_path_w.len] = 0; | 1707 | target_path_w.data[target_path_w.len] = 0; |
| | 1708 | // However, we need to canonicalize any path separators to `\`, since if |
| | 1709 | // the target path is relative, then it must use `\` as the path separator. |
| | 1710 | mem.replaceScalar( |
| | 1711 | u16, |
| | 1712 | target_path_w.data[0..target_path_w.len], |
| | 1713 | mem.nativeToLittle(u16, '/'), |
| | 1714 | mem.nativeToLittle(u16, '\\'), |
| | 1715 | ); |
| | 1716 | |
| 1708 | const sym_link_path_w = try std.os.windows.sliceToPrefixedFileW(self.fd, sym_link_path); | 1717 | const sym_link_path_w = try std.os.windows.sliceToPrefixedFileW(self.fd, sym_link_path); |
| 1709 | return self.symLinkW(target_path_w.span(), sym_link_path_w.span(), flags); | 1718 | return self.symLinkW(target_path_w.span(), sym_link_path_w.span(), flags); |
| 1710 | } | 1719 | } |
| ... | @@ -1744,6 +1753,7 @@ pub fn symLinkW( | ... | @@ -1744,6 +1753,7 @@ pub fn symLinkW( |
| 1744 | self: Dir, | 1753 | self: Dir, |
| 1745 | /// WTF-16, does not need to be NT-prefixed. The NT-prefixing | 1754 | /// WTF-16, does not need to be NT-prefixed. The NT-prefixing |
| 1746 | /// of this path is handled by CreateSymbolicLink. | 1755 | /// of this path is handled by CreateSymbolicLink. |
| | 1756 | /// Any path separators must be `\`, not `/`. |
| 1747 | target_path_w: [:0]const u16, | 1757 | target_path_w: [:0]const u16, |
| 1748 | /// WTF-16, must be NT-prefixed or relative | 1758 | /// WTF-16, must be NT-prefixed or relative |
| 1749 | sym_link_path_w: []const u16, | 1759 | sym_link_path_w: []const u16, |