authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-08-02 19:36:49+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-08-02 19:36:49+02:00
log4b0ab0c1864677d0c50b2a8e12a708a6640d1734
treec4063c5a8ded6dfbb82b604c5e8181c38350c8e9
parentf6ae2505d999305e1b5618fca9d928d96d9299af
signature Signed by PGP key 4AEE18F83AFDEB23

Apply suggestions from code review

Co-authored-by: Andrew Kelley <andrew@ziglang.org>

1 files changed, 5 insertions(+), 5 deletions(-)

lib/std/os.zig+5-5
...@@ -2233,7 +2233,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: u32) MakeDirError!void {...@@ -2233,7 +2233,7 @@ pub fn mkdirZ(dir_path: [*:0]const u8, mode: u32) MakeDirError!void {
2233 }2233 }
2234}2234}
22352235
2236/// Windows-only. Same as `mkdir` but the parameters is null-terminated, WTF16 encoded.2236/// Windows-only. Same as `mkdir` but the parameters is WTF16 encoded.
2237pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {2237pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {
2238 const sub_dir_handle = windows.OpenFile(dir_path_w, .{2238 const sub_dir_handle = windows.OpenFile(dir_path_w, .{
2239 .dir = std.fs.cwd().fd,2239 .dir = std.fs.cwd().fd,
...@@ -2304,7 +2304,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void {...@@ -2304,7 +2304,7 @@ pub fn rmdirZ(dir_path: [*:0]const u8) DeleteDirError!void {
2304 }2304 }
2305}2305}
23062306
2307/// Windows-only. Same as `rmdir` except the parameter is null-terminated, WTF16 encoded.2307/// Windows-only. Same as `rmdir` except the parameter is WTF16 encoded.
2308pub fn rmdirW(dir_path_w: []const u16) DeleteDirError!void {2308pub fn rmdirW(dir_path_w: []const u16) DeleteDirError!void {
2309 return windows.DeleteFile(dir_path_w, .{ .dir = std.fs.cwd().fd, .remove_dir = true }) catch |err| switch (err) {2309 return windows.DeleteFile(dir_path_w, .{ .dir = std.fs.cwd().fd, .remove_dir = true }) catch |err| switch (err) {
2310 error.IsDir => unreachable,2310 error.IsDir => unreachable,
...@@ -2411,7 +2411,7 @@ pub fn readlink(file_path: []const u8, out_buffer: []u8) ReadLinkError![]u8 {...@@ -2411,7 +2411,7 @@ pub fn readlink(file_path: []const u8, out_buffer: []u8) ReadLinkError![]u8 {
24112411
2412pub const readlinkC = @compileError("deprecated: renamed to readlinkZ");2412pub const readlinkC = @compileError("deprecated: renamed to readlinkZ");
24132413
2414/// Windows-only. Same as `readlink` except `file_path` is null-terminated, WTF16 encoded.2414/// Windows-only. Same as `readlink` except `file_path` is WTF16 encoded.
2415/// See also `readlinkZ`.2415/// See also `readlinkZ`.
2416pub fn readlinkW(file_path: []const u16, out_buffer: []u8) ReadLinkError![]u8 {2416pub fn readlinkW(file_path: []const u16, out_buffer: []u8) ReadLinkError![]u8 {
2417 return windows.ReadLink(std.fs.cwd().fd, file_path, out_buffer);2417 return windows.ReadLink(std.fs.cwd().fd, file_path, out_buffer);
...@@ -4059,8 +4059,8 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP...@@ -4059,8 +4059,8 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP
4059 return mem.spanZ(result_path);4059 return mem.spanZ(result_path);
4060}4060}
40614061
4062/// Same as `realpath` except `pathname` is null-terminated and UTF16LE-encoded.4062/// Same as `realpath` except `pathname` is UTF16LE-encoded.
4063/// TODO use ntdll for better semantics4063/// TODO use ntdll to emulate `GetFinalPathNameByHandleW` routine
4064pub fn realpathW(pathname: []const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {4064pub fn realpathW(pathname: []const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
4065 const w = windows;4065 const w = windows;
40664066