| ... | @@ -2053,6 +2053,22 @@ pub fn accessC(path: [*]const u8, mode: u32) AccessError!void { | ... | @@ -2053,6 +2053,22 @@ pub fn accessC(path: [*]const u8, mode: u32) AccessError!void { |
| 2053 | } | 2053 | } |
| 2054 | } | 2054 | } |
| 2055 | | 2055 | |
| | 2056 | /// Call from Windows-specific code if you already have a UTF-16LE encoded, null terminated string. |
| | 2057 | /// Otherwise use `access` or `accessC`. |
| | 2058 | /// TODO currently this ignores `mode`. |
| | 2059 | pub fn accessW(path: [*]const u16, mode: u32) windows.GetFileAttributesError!void { |
| | 2060 | const ret = try windows.GetFileAttributesW(path); |
| | 2061 | if (ret != windows.INVALID_FILE_ATTRIBUTES) { |
| | 2062 | return; |
| | 2063 | } |
| | 2064 | switch (windows.kernel32.GetLastError()) { |
| | 2065 | windows.ERROR.FILE_NOT_FOUND => return error.FileNotFound, |
| | 2066 | windows.ERROR.PATH_NOT_FOUND => return error.FileNotFound, |
| | 2067 | windows.ERROR.ACCESS_DENIED => return error.PermissionDenied, |
| | 2068 | else => |err| return windows.unexpectedError(err), |
| | 2069 | } |
| | 2070 | } |
| | 2071 | |
| 2056 | pub const PipeError = error{ | 2072 | pub const PipeError = error{ |
| 2057 | SystemFdQuotaExceeded, | 2073 | SystemFdQuotaExceeded, |
| 2058 | ProcessFdQuotaExceeded, | 2074 | ProcessFdQuotaExceeded, |