| ... | ... | @@ -1667,13 +1667,13 @@ pub const UnlinkError = error{ |
| 1667 | 1667 | pub fn unlink(file_path: []const u8) UnlinkError!void { |
| 1668 | 1668 | if (builtin.os.tag == .wasi) { |
| 1669 | 1669 | @compileError("unlink is not supported in WASI; use unlinkat instead"); |
| 1670 | | } |
| 1671 | | if (builtin.os.tag == .windows) { |
| 1670 | } else if (builtin.os.tag == .windows) { |
| 1672 | 1671 | const file_path_w = try windows.sliceToPrefixedFileW(file_path); |
| 1673 | 1672 | return windows.DeleteFileW(file_path_w.span().ptr); |
| 1673 | } else { |
| 1674 | const file_path_c = try toPosixPath(file_path); |
| 1675 | return unlinkZ(&file_path_c); |
| 1674 | 1676 | } |
| 1675 | | const file_path_c = try toPosixPath(file_path); |
| 1676 | | return unlinkZ(&file_path_c); |
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | pub const unlinkC = @compileError("deprecated: renamed to unlinkZ"); |
| ... | ... | @@ -1874,15 +1874,15 @@ const RenameError = error{ |
| 1874 | 1874 | pub fn rename(old_path: []const u8, new_path: []const u8) RenameError!void { |
| 1875 | 1875 | if (builtin.os.tag == .wasi) { |
| 1876 | 1876 | @compileError("rename is not supported in WASI; use renameat instead"); |
| 1877 | | } |
| 1878 | | if (builtin.os.tag == .windows) { |
| 1877 | } else if (builtin.os.tag == .windows) { |
| 1879 | 1878 | const old_path_w = try windows.sliceToPrefixedFileW(old_path); |
| 1880 | 1879 | const new_path_w = try windows.sliceToPrefixedFileW(new_path); |
| 1881 | 1880 | return renameW(old_path_w.span().ptr, new_path_w.span().ptr); |
| 1881 | } else { |
| 1882 | const old_path_c = try toPosixPath(old_path); |
| 1883 | const new_path_c = try toPosixPath(new_path); |
| 1884 | return renameZ(&old_path_c, &new_path_c); |
| 1882 | 1885 | } |
| 1883 | | const old_path_c = try toPosixPath(old_path); |
| 1884 | | const new_path_c = try toPosixPath(new_path); |
| 1885 | | return renameZ(&old_path_c, &new_path_c); |
| 1886 | 1886 | } |
| 1887 | 1887 | |
| 1888 | 1888 | pub const renameC = @compileError("deprecated: renamed to renameZ"); |
| ... | ... | @@ -2153,14 +2153,14 @@ pub fn mkdiratW(dir_fd: fd_t, sub_path_w: [*:0]const u16, mode: u32) MakeDirErro |
| 2153 | 2153 | pub fn mkdir(dir_path: []const u8, mode: u32) MakeDirError!void { |
| 2154 | 2154 | if (builtin.os.tag == .wasi) { |
| 2155 | 2155 | @compileError("mkdir is not supported in WASI; use mkdirat instead"); |
| 2156 | | } |
| 2157 | | if (builtin.os.tag == .windows) { |
| 2156 | } else if (builtin.os.tag == .windows) { |
| 2158 | 2157 | const sub_dir_handle = try windows.CreateDirectory(null, dir_path, null); |
| 2159 | 2158 | windows.CloseHandle(sub_dir_handle); |
| 2160 | 2159 | return; |
| 2160 | } else { |
| 2161 | const dir_path_c = try toPosixPath(dir_path); |
| 2162 | return mkdirZ(&dir_path_c, mode); |
| 2161 | 2163 | } |
| 2162 | | const dir_path_c = try toPosixPath(dir_path); |
| 2163 | | return mkdirZ(&dir_path_c, mode); |
| 2164 | 2164 | } |
| 2165 | 2165 | |
| 2166 | 2166 | /// Same as `mkdir` but the parameter is a null-terminated UTF8-encoded string. |
| ... | ... | @@ -2208,13 +2208,13 @@ pub const DeleteDirError = error{ |
| 2208 | 2208 | pub fn rmdir(dir_path: []const u8) DeleteDirError!void { |
| 2209 | 2209 | if (builtin.os.tag == .wasi) { |
| 2210 | 2210 | @compileError("rmdir is not supported in WASI; use unlinkat instead"); |
| 2211 | | } |
| 2212 | | if (builtin.os.tag == .windows) { |
| 2211 | } else if (builtin.os.tag == .windows) { |
| 2213 | 2212 | const dir_path_w = try windows.sliceToPrefixedFileW(dir_path); |
| 2214 | 2213 | return windows.RemoveDirectoryW(dir_path_w.span().ptr); |
| 2214 | } else { |
| 2215 | const dir_path_c = try toPosixPath(dir_path); |
| 2216 | return rmdirZ(&dir_path_c); |
| 2215 | 2217 | } |
| 2216 | | const dir_path_c = try toPosixPath(dir_path); |
| 2217 | | return rmdirZ(&dir_path_c); |
| 2218 | 2218 | } |
| 2219 | 2219 | |
| 2220 | 2220 | pub const rmdirC = @compileError("deprecated: renamed to rmdirZ"); |
| ... | ... | @@ -2259,13 +2259,13 @@ pub const ChangeCurDirError = error{ |
| 2259 | 2259 | pub fn chdir(dir_path: []const u8) ChangeCurDirError!void { |
| 2260 | 2260 | if (builtin.os.tag == .wasi) { |
| 2261 | 2261 | @compileError("chdir is not supported in WASI"); |
| 2262 | | } |
| 2263 | | if (builtin.os.tag == .windows) { |
| 2262 | } else if (builtin.os.tag == .windows) { |
| 2264 | 2263 | const dir_path_w = try windows.sliceToPrefixedFileW(dir_path); |
| 2265 | 2264 | @compileError("TODO implement chdir for Windows"); |
| 2265 | } else { |
| 2266 | const dir_path_c = try toPosixPath(dir_path); |
| 2267 | return chdirZ(&dir_path_c); |
| 2266 | 2268 | } |
| 2267 | | const dir_path_c = try toPosixPath(dir_path); |
| 2268 | | return chdirZ(&dir_path_c); |
| 2269 | 2269 | } |
| 2270 | 2270 | |
| 2271 | 2271 | pub const chdirC = @compileError("deprecated: renamed to chdirZ"); |
| ... | ... | @@ -2325,13 +2325,13 @@ pub const ReadLinkError = error{ |
| 2325 | 2325 | pub fn readlink(file_path: []const u8, out_buffer: []u8) ReadLinkError![]u8 { |
| 2326 | 2326 | if (builtin.os.tag == .wasi) { |
| 2327 | 2327 | @compileError("readlink is not supported in WASI; use readlinkat instead"); |
| 2328 | | } |
| 2329 | | if (builtin.os.tag == .windows) { |
| 2328 | } else if (builtin.os.tag == .windows) { |
| 2330 | 2329 | const file_path_w = try windows.sliceToPrefixedFileW(file_path); |
| 2331 | 2330 | return readlinkW(file_path_w.span().ptr, out_buffer); |
| 2331 | } else { |
| 2332 | const file_path_c = try toPosixPath(file_path); |
| 2333 | return readlinkZ(&file_path_c, out_buffer); |
| 2332 | 2334 | } |
| 2333 | | const file_path_c = try toPosixPath(file_path); |
| 2334 | | return readlinkZ(&file_path_c, out_buffer); |
| 2335 | 2335 | } |
| 2336 | 2336 | |
| 2337 | 2337 | pub const readlinkC = @compileError("deprecated: renamed to readlinkZ"); |
| ... | ... | @@ -3089,6 +3089,9 @@ pub fn fstat(fd: fd_t) FStatError!Stat { |
| 3089 | 3089 | else => |err| return unexpectedErrno(err), |
| 3090 | 3090 | } |
| 3091 | 3091 | } |
| 3092 | if (builtin.os.tag == .windows) { |
| 3093 | @compileError("fstat is not yet implemented on Windows"); |
| 3094 | } |
| 3092 | 3095 | |
| 3093 | 3096 | var stat: Stat = undefined; |
| 3094 | 3097 | switch (errno(system.fstat(fd, &stat))) { |
| ... | ... | @@ -3109,9 +3112,12 @@ pub const FStatAtError = FStatError || error{ NameTooLong, FileNotFound }; |
| 3109 | 3112 | pub fn fstatat(dirfd: fd_t, pathname: []const u8, flags: u32) FStatAtError!Stat { |
| 3110 | 3113 | if (builtin.os.tag == .wasi) { |
| 3111 | 3114 | return fstatatWasi(dirfd, pathname, flags); |
| 3115 | } else if (builtin.os.tag == .windows) { |
| 3116 | @compileError("fstatat is not yet implemented on Windows"); |
| 3117 | } else { |
| 3118 | const pathname_c = try toPosixPath(pathname); |
| 3119 | return fstatatZ(dirfd, &pathname_c, flags); |
| 3112 | 3120 | } |
| 3113 | | const pathname_c = try toPosixPath(pathname); |
| 3114 | | return fstatatZ(dirfd, &pathname_c, flags); |
| 3115 | 3121 | } |
| 3116 | 3122 | |
| 3117 | 3123 | pub const fstatatC = @compileError("deprecated: renamed to fstatatZ"); |