| ... | ... | @@ -2691,8 +2691,7 @@ pub fn renameatW( |
| 2691 | 2691 | /// On other platforms, `sub_dir_path` is an opaque sequence of bytes with no particular encoding. |
| 2692 | 2692 | pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: mode_t) MakeDirError!void { |
| 2693 | 2693 | if (native_os == .windows) { |
| 2694 | | const sub_dir_path_w = try windows.sliceToPrefixedFileW(dir_fd, sub_dir_path); |
| 2695 | | return mkdiratW(dir_fd, sub_dir_path_w.span(), mode); |
| 2694 | @compileError("use std.Io instead"); |
| 2696 | 2695 | } else if (native_os == .wasi and !builtin.link_libc) { |
| 2697 | 2696 | @compileError("use std.Io instead"); |
| 2698 | 2697 | } else { |
| ... | ... | @@ -2704,10 +2703,9 @@ pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: mode_t) MakeDirErro |
| 2704 | 2703 | /// Same as `mkdirat` except the parameters are null-terminated. |
| 2705 | 2704 | pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDirError!void { |
| 2706 | 2705 | if (native_os == .windows) { |
| 2707 | | const sub_dir_path_w = try windows.cStrToPrefixedFileW(dir_fd, sub_dir_path); |
| 2708 | | return mkdiratW(dir_fd, sub_dir_path_w.span(), mode); |
| 2706 | @compileError("use std.Io instead"); |
| 2709 | 2707 | } else if (native_os == .wasi and !builtin.link_libc) { |
| 2710 | | return mkdirat(dir_fd, mem.sliceTo(sub_dir_path, 0), mode); |
| 2708 | @compileError("use std.Io instead"); |
| 2711 | 2709 | } |
| 2712 | 2710 | switch (errno(system.mkdirat(dir_fd, sub_dir_path, mode))) { |
| 2713 | 2711 | .SUCCESS => return, |
| ... | ... | @@ -2732,25 +2730,6 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDir |
| 2732 | 2730 | } |
| 2733 | 2731 | } |
| 2734 | 2732 | |
| 2735 | | /// Windows-only. Same as `mkdirat` except the parameter WTF16 LE encoded. |
| 2736 | | pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: mode_t) MakeDirError!void { |
| 2737 | | _ = mode; |
| 2738 | | const sub_dir_handle = windows.OpenFile(sub_path_w, .{ |
| 2739 | | .dir = dir_fd, |
| 2740 | | .access_mask = windows.GENERIC_READ | windows.SYNCHRONIZE, |
| 2741 | | .creation = windows.FILE_CREATE, |
| 2742 | | .filter = .dir_only, |
| 2743 | | }) catch |err| switch (err) { |
| 2744 | | error.IsDir => return error.Unexpected, |
| 2745 | | error.PipeBusy => return error.Unexpected, |
| 2746 | | error.NoDevice => return error.Unexpected, |
| 2747 | | error.WouldBlock => return error.Unexpected, |
| 2748 | | error.AntivirusInterference => return error.Unexpected, |
| 2749 | | else => |e| return e, |
| 2750 | | }; |
| 2751 | | windows.CloseHandle(sub_dir_handle); |
| 2752 | | } |
| 2753 | | |
| 2754 | 2733 | pub const MakeDirError = std.Io.Dir.MakeError; |
| 2755 | 2734 | |
| 2756 | 2735 | /// Create a directory. |