authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-19 16:42:28-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:11-08:00
loga8088306f6223b07ad9b7ae37486bcc9e0ac08c9
tree335a999489c68619b496068062a31e572d262e50
parent6e0c7ed8659d9d60a59a9dcddd3aed9cd18b659b

std: rename other Dir "make" functions to "create"


31 files changed, 171 insertions(+), 176 deletions(-)

lib/compiler/build_runner.zig+3-3
......@@ -66,12 +66,12 @@ pub fn main() !void {
6666
6767 const local_cache_directory: std.Build.Cache.Directory = .{
6868 .path = cache_root,
69 .handle = try cwd.makeOpenPath(io, cache_root, .{}),
69 .handle = try cwd.createDirPathOpen(io, cache_root, .{}),
7070 };
7171
7272 const global_cache_directory: std.Build.Cache.Directory = .{
7373 .path = global_cache_root,
74 .handle = try cwd.makeOpenPath(io, global_cache_root, .{}),
74 .handle = try cwd.createDirPathOpen(io, global_cache_root, .{}),
7575 };
7676
7777 var graph: std.Build.Graph = .{
......@@ -80,7 +80,7 @@ pub fn main() !void {
8080 .cache = .{
8181 .io = io,
8282 .gpa = arena,
83 .manifest_dir = try local_cache_directory.handle.makeOpenPath(io, "h", .{}),
83 .manifest_dir = try local_cache_directory.handle.createDirPathOpen(io, "h", .{}),
8484 },
8585 .zig_exe = zig_exe,
8686 .env_map = try process.getEnvMap(arena),
lib/compiler/translate-c/main.zig+1-1
......@@ -253,7 +253,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: [][:0]u8, zig_integration
253253 if (d.output_name) |path| blk: {
254254 if (std.mem.eql(u8, path, "-")) break :blk;
255255 if (std.fs.path.dirname(path)) |dirname| {
256 Io.Dir.cwd().makePath(io, dirname) catch |err|
256 Io.Dir.cwd().createDirPath(io, dirname) catch |err|
257257 return d.fatal("failed to create path to '{s}': {s}", .{ path, aro.Driver.errorDescription(err) });
258258 }
259259 out_file = Io.Dir.cwd().createFile(io, path, .{}) catch |err| {
lib/std/Build.zig+3-3
......@@ -1701,14 +1701,14 @@ pub fn addCheckFile(
17011701 return Step.CheckFile.create(b, file_source, options);
17021702}
17031703
1704pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.MakeError || Io.Dir.StatFileError)!void {
1704pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.CreateDirError || Io.Dir.StatFileError)!void {
17051705 const io = b.graph.io;
17061706 if (b.verbose) log.info("truncate {s}", .{dest_path});
17071707 const cwd = Io.Dir.cwd();
17081708 var src_file = cwd.createFile(io, dest_path, .{}) catch |err| switch (err) {
17091709 error.FileNotFound => blk: {
17101710 if (fs.path.dirname(dest_path)) |dirname| {
1711 try cwd.makePath(io, dirname);
1711 try cwd.createDirPath(io, dirname);
17121712 }
17131713 break :blk try cwd.createFile(io, dest_path, .{});
17141714 },
......@@ -2654,7 +2654,7 @@ pub fn makeTempPath(b: *Build) []const u8 {
26542654 const rand_int = std.crypto.random.int(u64);
26552655 const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
26562656 const result_path = b.cache_root.join(b.allocator, &.{tmp_dir_sub_path}) catch @panic("OOM");
2657 b.cache_root.handle.makePath(io, tmp_dir_sub_path) catch |err| {
2657 b.cache_root.handle.createDirPath(io, tmp_dir_sub_path) catch |err| {
26582658 std.debug.print("unable to make tmp path '{s}': {t}\n", .{ result_path, err });
26592659 };
26602660 return result_path;
lib/std/Build/Cache.zig+4-4
......@@ -1330,7 +1330,7 @@ test "cache file and then recall it" {
13301330 var cache: Cache = .{
13311331 .io = io,
13321332 .gpa = testing.allocator,
1333 .manifest_dir = try tmp.dir.makeOpenPath(io, temp_manifest_dir, .{}),
1333 .manifest_dir = try tmp.dir.createDirPathOpen(io, temp_manifest_dir, .{}),
13341334 };
13351335 cache.addPrefix(.{ .path = null, .handle = tmp.dir });
13361336 defer cache.manifest_dir.close(io);
......@@ -1396,7 +1396,7 @@ test "check that changing a file makes cache fail" {
13961396 var cache: Cache = .{
13971397 .io = io,
13981398 .gpa = testing.allocator,
1399 .manifest_dir = try tmp.dir.makeOpenPath(io, temp_manifest_dir, .{}),
1399 .manifest_dir = try tmp.dir.createDirPathOpen(io, temp_manifest_dir, .{}),
14001400 };
14011401 cache.addPrefix(.{ .path = null, .handle = tmp.dir });
14021402 defer cache.manifest_dir.close(io);
......@@ -1456,7 +1456,7 @@ test "no file inputs" {
14561456 var cache: Cache = .{
14571457 .io = io,
14581458 .gpa = testing.allocator,
1459 .manifest_dir = try tmp.dir.makeOpenPath(io, temp_manifest_dir, .{}),
1459 .manifest_dir = try tmp.dir.createDirPathOpen(io, temp_manifest_dir, .{}),
14601460 };
14611461 cache.addPrefix(.{ .path = null, .handle = tmp.dir });
14621462 defer cache.manifest_dir.close(io);
......@@ -1515,7 +1515,7 @@ test "Manifest with files added after initial hash work" {
15151515 var cache: Cache = .{
15161516 .io = io,
15171517 .gpa = testing.allocator,
1518 .manifest_dir = try tmp.dir.makeOpenPath(io, temp_manifest_dir, .{}),
1518 .manifest_dir = try tmp.dir.createDirPathOpen(io, temp_manifest_dir, .{}),
15191519 };
15201520 cache.addPrefix(.{ .path = null, .handle = tmp.dir });
15211521 defer cache.manifest_dir.close(io);
lib/std/Build/Cache/Path.zig+4-4
......@@ -84,14 +84,14 @@ pub fn openDir(
8484 return p.root_dir.handle.openDir(io, joined_path, args);
8585}
8686
87pub fn makeOpenPath(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.OpenOptions) !Io.Dir {
87pub fn createDirPathOpen(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.OpenOptions) !Io.Dir {
8888 var buf: [fs.max_path_bytes]u8 = undefined;
8989 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
9090 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
9191 p.sub_path, sub_path,
9292 }) catch return error.NameTooLong;
9393 };
94 return p.root_dir.handle.makeOpenPath(io, joined_path, opts);
94 return p.root_dir.handle.createDirPathOpen(io, joined_path, opts);
9595}
9696
9797pub fn statFile(p: Path, io: Io, sub_path: []const u8) !Io.Dir.Stat {
......@@ -129,14 +129,14 @@ pub fn access(p: Path, io: Io, sub_path: []const u8, flags: Io.Dir.AccessOptions
129129 return p.root_dir.handle.access(io, joined_path, flags);
130130}
131131
132pub fn makePath(p: Path, io: Io, sub_path: []const u8) !void {
132pub fn createDirPath(p: Path, io: Io, sub_path: []const u8) !void {
133133 var buf: [fs.max_path_bytes]u8 = undefined;
134134 const joined_path = if (p.sub_path.len == 0) sub_path else p: {
135135 break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
136136 p.sub_path, sub_path,
137137 }) catch return error.NameTooLong;
138138 };
139 return p.root_dir.handle.makePath(io, joined_path);
139 return p.root_dir.handle.createDirPath(io, joined_path);
140140}
141141
142142pub fn toString(p: Path, allocator: Allocator) Allocator.Error![]u8 {
lib/std/Build/Step.zig+3-3
......@@ -516,12 +516,12 @@ pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u
516516 return s.fail("unable to update file from '{f}' to '{s}': {t}", .{ src_path, dest_path, err });
517517}
518518
519/// Wrapper around `Io.Dir.makePathStatus` that handles verbose and error output.
520pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.MakePathStatus {
519/// Wrapper around `Io.Dir.createDirPathStatus` that handles verbose and error output.
520pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.CreatePathStatus {
521521 const b = s.owner;
522522 const io = b.graph.io;
523523 try handleVerbose(b, null, &.{ "install", "-d", dest_path });
524 return Io.Dir.cwd().makePathStatus(io, dest_path, .default_dir) catch |err|
524 return Io.Dir.cwd().createDirPathStatus(io, dest_path, .default_dir) catch |err|
525525 return s.fail("unable to create dir '{s}': {t}", .{ dest_path, err });
526526}
527527
lib/std/Build/Step/Compile.zig+2-2
......@@ -1669,7 +1669,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
16691669 args_length += arg.len + 1; // +1 to account for null terminator
16701670 }
16711671 if (args_length >= 30 * 1024) {
1672 try b.cache_root.handle.makePath(io, "args");
1672 try b.cache_root.handle.createDirPath(io, "args");
16731673
16741674 const args_to_escape = zig_args.items[2..];
16751675 var escaped_args = try std.array_list.Managed([]const u8).initCapacity(arena, args_to_escape.len);
......@@ -1706,7 +1706,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
17061706 // The args file is already present from a previous run.
17071707 } else |err| switch (err) {
17081708 error.FileNotFound => {
1709 try b.cache_root.handle.makePath(io, "tmp");
1709 try b.cache_root.handle.createDirPath(io, "tmp");
17101710 const rand_int = std.crypto.random.int(u64);
17111711 const tmp_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
17121712 try b.cache_root.handle.writeFile(io, .{ .sub_path = tmp_path, .data = args });
lib/std/Build/Step/ConfigHeader.zig+1-1
......@@ -258,7 +258,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
258258 const sub_path = b.pathJoin(&.{ "o", &digest, config_header.include_path });
259259 const sub_path_dirname = std.fs.path.dirname(sub_path).?;
260260
261 b.cache_root.handle.makePath(io, sub_path_dirname) catch |err| {
261 b.cache_root.handle.createDirPath(io, sub_path_dirname) catch |err| {
262262 return step.fail("unable to make path '{f}{s}': {s}", .{
263263 b.cache_root, sub_path_dirname, @errorName(err),
264264 });
lib/std/Build/Step/ObjCopy.zig+1-1
......@@ -177,7 +177,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
177177 const cache_path = "o" ++ fs.path.sep_str ++ digest;
178178 const full_dest_path = try b.cache_root.join(b.allocator, &.{ cache_path, objcopy.basename });
179179 const full_dest_path_debug = try b.cache_root.join(b.allocator, &.{ cache_path, b.fmt("{s}.debug", .{objcopy.basename}) });
180 b.cache_root.handle.makePath(io, cache_path) catch |err| {
180 b.cache_root.handle.createDirPath(io, cache_path) catch |err| {
181181 return step.fail("unable to make path {s}: {s}", .{ cache_path, @errorName(err) });
182182 };
183183
lib/std/Build/Step/Options.zig+2-2
......@@ -477,7 +477,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
477477 } else |outer_err| switch (outer_err) {
478478 error.FileNotFound => {
479479 const sub_dirname = fs.path.dirname(sub_path).?;
480 b.cache_root.handle.makePath(io, sub_dirname) catch |e|
480 b.cache_root.handle.createDirPath(io, sub_dirname) catch |e|
481481 return step.fail("unable to make path '{f}{s}': {t}", .{ b.cache_root, sub_dirname, e });
482482
483483 const rand_int = std.crypto.random.int(u64);
......@@ -486,7 +486,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
486486 basename;
487487 const tmp_sub_path_dirname = fs.path.dirname(tmp_sub_path).?;
488488
489 b.cache_root.handle.makePath(io, tmp_sub_path_dirname) catch |err| {
489 b.cache_root.handle.createDirPath(io, tmp_sub_path_dirname) catch |err| {
490490 return step.fail("unable to make temporary directory '{f}{s}': {t}", .{
491491 b.cache_root, tmp_sub_path_dirname, err,
492492 });
lib/std/Build/Step/Run.zig+3-3
......@@ -975,7 +975,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
975975 .output_directory => output_sub_path,
976976 else => unreachable,
977977 };
978 b.cache_root.handle.makePath(io, output_sub_dir_path) catch |err| {
978 b.cache_root.handle.createDirPath(io, output_sub_dir_path) catch |err| {
979979 return step.fail("unable to make path '{f}{s}': {s}", .{
980980 b.cache_root, output_sub_dir_path, @errorName(err),
981981 });
......@@ -1007,7 +1007,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
10071007 .output_directory => output_sub_path,
10081008 else => unreachable,
10091009 };
1010 b.cache_root.handle.makePath(io, output_sub_dir_path) catch |err| {
1010 b.cache_root.handle.createDirPath(io, output_sub_dir_path) catch |err| {
10111011 return step.fail("unable to make path '{f}{s}': {s}", .{
10121012 b.cache_root, output_sub_dir_path, @errorName(err),
10131013 });
......@@ -1439,7 +1439,7 @@ fn runCommand(
14391439
14401440 const sub_path = b.pathJoin(&output_components);
14411441 const sub_path_dirname = Dir.path.dirname(sub_path).?;
1442 b.cache_root.handle.makePath(io, sub_path_dirname) catch |err| {
1442 b.cache_root.handle.createDirPath(io, sub_path_dirname) catch |err| {
14431443 return step.fail("unable to make path '{f}{s}': {s}", .{
14441444 b.cache_root, sub_path_dirname, @errorName(err),
14451445 });
lib/std/Build/Step/UpdateSourceFiles.zig+1-1
......@@ -78,7 +78,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
7878 var any_miss = false;
7979 for (usf.output_source_files.items) |output_source_file| {
8080 if (fs.path.dirname(output_source_file.sub_path)) |dirname| {
81 b.build_root.handle.makePath(io, dirname) catch |err| {
81 b.build_root.handle.createDirPath(io, dirname) catch |err| {
8282 return step.fail("unable to make path '{f}{s}': {t}", .{ b.build_root, dirname, err });
8383 };
8484 }
lib/std/Build/Step/WriteFile.zig+4-4
......@@ -259,13 +259,13 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
259259
260260 write_file.generated_directory.path = try b.cache_root.join(arena, &.{ "o", &digest });
261261
262 var cache_dir = b.cache_root.handle.makeOpenPath(io, cache_path, .{}) catch |err|
262 var cache_dir = b.cache_root.handle.createDirPathOpen(io, cache_path, .{}) catch |err|
263263 return step.fail("unable to make path '{f}{s}': {t}", .{ b.cache_root, cache_path, err });
264264 defer cache_dir.close(io);
265265
266266 for (write_file.files.items) |file| {
267267 if (fs.path.dirname(file.sub_path)) |dirname| {
268 cache_dir.makePath(io, dirname) catch |err| {
268 cache_dir.createDirPath(io, dirname) catch |err| {
269269 return step.fail("unable to make path '{f}{s}{c}{s}': {t}", .{
270270 b.cache_root, cache_path, fs.path.sep, dirname, err,
271271 });
......@@ -300,7 +300,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
300300 const dest_dirname = dir.sub_path;
301301
302302 if (dest_dirname.len != 0) {
303 cache_dir.makePath(io, dest_dirname) catch |err| {
303 cache_dir.createDirPath(io, dest_dirname) catch |err| {
304304 return step.fail("unable to make path '{f}{s}{c}{s}': {s}", .{
305305 b.cache_root, cache_path, fs.path.sep, dest_dirname, @errorName(err),
306306 });
......@@ -315,7 +315,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
315315 const src_entry_path = try src_dir_path.join(arena, entry.path);
316316 const dest_path = b.pathJoin(&.{ dest_dirname, entry.path });
317317 switch (entry.kind) {
318 .directory => try cache_dir.makePath(io, dest_path),
318 .directory => try cache_dir.createDirPath(io, dest_path),
319319 .file => {
320320 const prev_status = Io.Dir.updateFile(
321321 src_entry_path.root_dir.handle,
lib/std/Io.zig+3-3
......@@ -659,9 +659,9 @@ pub const VTable = struct {
659659 futexWaitUncancelable: *const fn (?*anyopaque, ptr: *const u32, expected: u32) void,
660660 futexWake: *const fn (?*anyopaque, ptr: *const u32, max_waiters: u32) void,
661661
662 dirMake: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions) Dir.MakeError!void,
663 dirMakePath: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions) Dir.MakePathError!Dir.MakePathStatus,
664 dirMakeOpenPath: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions, Dir.OpenOptions) Dir.MakeOpenPathError!Dir,
662 dirCreateDir: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions) Dir.CreateDirError!void,
663 dirCreateDirPath: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions) Dir.CreateDirPathError!Dir.CreatePathStatus,
664 dirCreateDirPathOpen: *const fn (?*anyopaque, Dir, []const u8, Dir.Permissions, Dir.OpenOptions) Dir.CreateDirPathOpenError!Dir,
665665 dirOpenDir: *const fn (?*anyopaque, Dir, []const u8, Dir.OpenOptions) Dir.OpenError!Dir,
666666 dirStat: *const fn (?*anyopaque, Dir) Dir.StatError!Dir.Stat,
667667 dirStatFile: *const fn (?*anyopaque, Dir, []const u8, Dir.StatFileOptions) Dir.StatFileError!File.Stat,
lib/std/Io/Dir.zig+20-20
......@@ -590,7 +590,7 @@ pub fn updateFile(
590590 }
591591
592592 if (path.dirname(dest_path)) |dirname| {
593 try dest_dir.makePath(io, dirname);
593 try dest_dir.createDirPath(io, dirname);
594594 }
595595
596596 var buffer: [1000]u8 = undefined; // Used only when direct fd-to-fd is not available.
......@@ -637,7 +637,7 @@ pub fn readFile(dir: Dir, io: Io, file_path: []const u8, buffer: []u8) ReadFileE
637637 return buffer[0..n];
638638}
639639
640pub const MakeError = error{
640pub const CreateDirError = error{
641641 /// In WASI, this error may occur when the file descriptor does
642642 /// not hold the required rights to create a new directory relative to it.
643643 AccessDenied,
......@@ -663,10 +663,10 @@ pub const MakeError = error{
663663/// * On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding.
664664///
665665/// Related:
666/// * `makePath`
666/// * `createDirPath`
667667/// * `createDirAbsolute`
668pub fn createDir(dir: Dir, io: Io, sub_path: []const u8, permissions: Permissions) MakeError!void {
669 return io.vtable.dirMake(io.userdata, dir, sub_path, permissions);
668pub fn createDir(dir: Dir, io: Io, sub_path: []const u8, permissions: Permissions) CreateDirError!void {
669 return io.vtable.dirCreateDir(io.userdata, dir, sub_path, permissions);
670670}
671671
672672/// Create a new directory, based on an absolute path.
......@@ -677,14 +677,14 @@ pub fn createDir(dir: Dir, io: Io, sub_path: []const u8, permissions: Permission
677677/// On Windows, `absolute_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/).
678678/// On WASI, `absolute_path` should be encoded as valid UTF-8.
679679/// On other platforms, `absolute_path` is an opaque sequence of bytes with no particular encoding.
680pub fn createDirAbsolute(io: Io, absolute_path: []const u8, permissions: Permissions) MakeError!void {
680pub fn createDirAbsolute(io: Io, absolute_path: []const u8, permissions: Permissions) CreateDirError!void {
681681 assert(path.isAbsolute(absolute_path));
682682 return createDir(.cwd(), io, absolute_path, permissions);
683683}
684684
685685test createDirAbsolute {}
686686
687pub const MakePathError = MakeError || StatFileError;
687pub const CreateDirPathError = CreateDirError || StatFileError;
688688
689689/// Creates parent directories with default permissions as necessary to ensure
690690/// `sub_path` exists as a directory.
......@@ -710,27 +710,27 @@ pub const MakePathError = MakeError || StatFileError;
710710/// and a `./second` directory.
711711///
712712/// See also:
713/// * `makePathStatus`
714pub fn makePath(dir: Dir, io: Io, sub_path: []const u8) MakePathError!void {
715 _ = try io.vtable.dirMakePath(io.userdata, dir, sub_path, .default_dir);
713/// * `createDirPathStatus`
714pub fn createDirPath(dir: Dir, io: Io, sub_path: []const u8) CreateDirPathError!void {
715 _ = try io.vtable.dirCreateDirPath(io.userdata, dir, sub_path, .default_dir);
716716}
717717
718pub const MakePathStatus = enum { existed, created };
718pub const CreatePathStatus = enum { existed, created };
719719
720/// Same as `makePath` except returns whether the path already existed or was
720/// Same as `createDirPath` except returns whether the path already existed or was
721721/// successfully created.
722pub fn makePathStatus(dir: Dir, io: Io, sub_path: []const u8, permissions: Permissions) MakePathError!MakePathStatus {
723 return io.vtable.dirMakePath(io.userdata, dir, sub_path, permissions);
722pub fn createDirPathStatus(dir: Dir, io: Io, sub_path: []const u8, permissions: Permissions) CreateDirPathError!CreatePathStatus {
723 return io.vtable.dirCreateDirPath(io.userdata, dir, sub_path, permissions);
724724}
725725
726pub const MakeOpenPathError = MakeError || OpenError || StatFileError;
726pub const CreateDirPathOpenError = CreateDirError || OpenError || StatFileError;
727727
728pub const MakeOpenPathOptions = struct {
728pub const CreateDirPathOpenOptions = struct {
729729 open_options: OpenOptions = .{},
730730 permissions: Permissions = .default_dir,
731731};
732732
733/// Performs the equivalent of `makePath` followed by `openDir`, atomically if possible.
733/// Performs the equivalent of `createDirPath` followed by `openDir`, atomically if possible.
734734///
735735/// When this operation is canceled, it may leave the file system in a
736736/// partially modified state.
......@@ -738,8 +738,8 @@ pub const MakeOpenPathOptions = struct {
738738/// On Windows, `sub_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/).
739739/// On WASI, `sub_path` should be encoded as valid UTF-8.
740740/// On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding.
741pub fn makeOpenPath(dir: Dir, io: Io, sub_path: []const u8, options: MakeOpenPathOptions) MakeOpenPathError!Dir {
742 return io.vtable.dirMakeOpenPath(io.userdata, dir, sub_path, options.permissions, options.open_options);
741pub fn createDirPathOpen(dir: Dir, io: Io, sub_path: []const u8, options: CreateDirPathOpenOptions) CreateDirPathOpenError!Dir {
742 return io.vtable.dirCreateDirPathOpen(io.userdata, dir, sub_path, options.permissions, options.open_options);
743743}
744744
745745pub const Stat = File.Stat;
......@@ -1729,7 +1729,7 @@ pub const AtomicFileOptions = struct {
17291729pub fn atomicFile(parent: Dir, io: Io, dest_path: []const u8, options: AtomicFileOptions) !File.Atomic {
17301730 if (path.dirname(dest_path)) |dirname| {
17311731 const dir = if (options.make_path)
1732 try parent.makeOpenPath(io, dirname, .{})
1732 try parent.createDirPathOpen(io, dirname, .{})
17331733 else
17341734 try parent.openDir(io, dirname, .{});
17351735
lib/std/Io/Kqueue.zig+6-6
......@@ -869,9 +869,9 @@ pub fn io(k: *Kqueue) Io {
869869 .conditionWaitUncancelable = conditionWaitUncancelable,
870870 .conditionWake = conditionWake,
871871
872 .dirMake = dirMake,
873 .dirMakePath = dirMakePath,
874 .dirMakeOpenPath = dirMakeOpenPath,
872 .dirCreateDir = dirCreateDir,
873 .dirCreateDirPath = dirCreateDirPath,
874 .dirCreateDirPathOpen = dirCreateDirPathOpen,
875875 .dirStat = dirStat,
876876 .dirStatFile = dirStatFile,
877877
......@@ -1114,7 +1114,7 @@ fn conditionWake(userdata: ?*anyopaque, cond: *Io.Condition, wake: Io.Condition.
11141114 k.yield(waiting_fiber, .reschedule);
11151115}
11161116
1117fn dirMake(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.MakeError!void {
1117fn dirCreateDir(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.CreateDirError!void {
11181118 const k: *Kqueue = @ptrCast(@alignCast(userdata));
11191119 _ = k;
11201120 _ = dir;
......@@ -1122,7 +1122,7 @@ fn dirMake(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode
11221122 _ = mode;
11231123 @panic("TODO");
11241124}
1125fn dirMakePath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.MakeError!void {
1125fn dirCreateDirPath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.CreateDirError!void {
11261126 const k: *Kqueue = @ptrCast(@alignCast(userdata));
11271127 _ = k;
11281128 _ = dir;
......@@ -1130,7 +1130,7 @@ fn dirMakePath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.
11301130 _ = mode;
11311131 @panic("TODO");
11321132}
1133fn dirMakeOpenPath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.OpenOptions) Dir.MakeOpenPathError!Dir {
1133fn dirCreateDirPathOpen(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.OpenOptions) Dir.CreateDirPathOpenError!Dir {
11341134 const k: *Kqueue = @ptrCast(@alignCast(userdata));
11351135 _ = k;
11361136 _ = dir;
lib/std/Io/Threaded.zig+30-35
......@@ -711,9 +711,9 @@ pub fn io(t: *Threaded) Io {
711711 .futexWaitUncancelable = futexWaitUncancelable,
712712 .futexWake = futexWake,
713713
714 .dirMake = dirMake,
715 .dirMakePath = dirMakePath,
716 .dirMakeOpenPath = dirMakeOpenPath,
714 .dirCreateDir = dirCreateDir,
715 .dirCreateDirPath = dirCreateDirPath,
716 .dirCreateDirPathOpen = dirCreateDirPathOpen,
717717 .dirStat = dirStat,
718718 .dirStatFile = dirStatFile,
719719 .dirAccess = dirAccess,
......@@ -846,9 +846,9 @@ pub fn ioBasic(t: *Threaded) Io {
846846 .futexWaitUncancelable = futexWaitUncancelable,
847847 .futexWake = futexWake,
848848
849 .dirMake = dirMake,
850 .dirMakePath = dirMakePath,
851 .dirMakeOpenPath = dirMakeOpenPath,
849 .dirCreateDir = dirCreateDir,
850 .dirCreateDirPath = dirCreateDirPath,
851 .dirCreateDirPathOpen = dirCreateDirPathOpen,
852852 .dirStat = dirStat,
853853 .dirStatFile = dirStatFile,
854854 .dirAccess = dirAccess,
......@@ -1507,13 +1507,13 @@ fn futexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void {
15071507 }
15081508}
15091509
1510const dirMake = switch (native_os) {
1511 .windows => dirMakeWindows,
1512 .wasi => dirMakeWasi,
1513 else => dirMakePosix,
1510const dirCreateDir = switch (native_os) {
1511 .windows => dirCreateDirWindows,
1512 .wasi => dirCreateDirWasi,
1513 else => dirCreateDirPosix,
15141514};
15151515
1516fn dirMakePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.MakeError!void {
1516fn dirCreateDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void {
15171517 const t: *Threaded = @ptrCast(@alignCast(userdata));
15181518 const current_thread = Thread.getCurrent(t);
15191519
......@@ -1559,8 +1559,8 @@ fn dirMakePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissio
15591559 }
15601560}
15611561
1562fn dirMakeWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.MakeError!void {
1563 if (builtin.link_libc) return dirMakePosix(userdata, dir, sub_path, permissions);
1562fn dirCreateDirWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void {
1563 if (builtin.link_libc) return dirCreateDirPosix(userdata, dir, sub_path, permissions);
15641564 const t: *Threaded = @ptrCast(@alignCast(userdata));
15651565 const current_thread = Thread.getCurrent(t);
15661566 try current_thread.beginSyscall();
......@@ -1601,7 +1601,7 @@ fn dirMakeWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permission
16011601 }
16021602}
16031603
1604fn dirMakeWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.MakeError!void {
1604fn dirCreateDirWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void {
16051605 const t: *Threaded = @ptrCast(@alignCast(userdata));
16061606 const current_thread = Thread.getCurrent(t);
16071607 try current_thread.checkCancel();
......@@ -1627,19 +1627,19 @@ fn dirMakeWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permiss
16271627 windows.CloseHandle(sub_dir_handle);
16281628}
16291629
1630fn dirMakePath(
1630fn dirCreateDirPath(
16311631 userdata: ?*anyopaque,
16321632 dir: Dir,
16331633 sub_path: []const u8,
16341634 permissions: Dir.Permissions,
1635) Dir.MakePathError!Dir.MakePathStatus {
1635) Dir.CreateDirPathError!Dir.CreatePathStatus {
16361636 const t: *Threaded = @ptrCast(@alignCast(userdata));
16371637
16381638 var it = std.fs.path.componentIterator(sub_path);
1639 var status: Dir.MakePathStatus = .existed;
1639 var status: Dir.CreatePathStatus = .existed;
16401640 var component = it.last() orelse return error.BadPathName;
16411641 while (true) {
1642 if (dirMake(t, dir, component.path, permissions)) |_| {
1642 if (dirCreateDir(t, dir, component.path, permissions)) |_| {
16431643 status = .created;
16441644 } else |err| switch (err) {
16451645 error.PathAlreadyExists => {
......@@ -1659,37 +1659,37 @@ fn dirMakePath(
16591659 }
16601660}
16611661
1662const dirMakeOpenPath = switch (native_os) {
1663 .windows => dirMakeOpenPathWindows,
1664 .wasi => dirMakeOpenPathWasi,
1665 else => dirMakeOpenPathPosix,
1662const dirCreateDirPathOpen = switch (native_os) {
1663 .windows => dirCreateDirPathOpenWindows,
1664 .wasi => dirCreateDirPathOpenWasi,
1665 else => dirCreateDirPathOpenPosix,
16661666};
16671667
1668fn dirMakeOpenPathPosix(
1668fn dirCreateDirPathOpenPosix(
16691669 userdata: ?*anyopaque,
16701670 dir: Dir,
16711671 sub_path: []const u8,
16721672 permissions: Dir.Permissions,
16731673 options: Dir.OpenOptions,
1674) Dir.MakeOpenPathError!Dir {
1674) Dir.CreateDirPathOpenError!Dir {
16751675 const t: *Threaded = @ptrCast(@alignCast(userdata));
16761676 const t_io = ioBasic(t);
16771677 return dirOpenDirPosix(t, dir, sub_path, options) catch |err| switch (err) {
16781678 error.FileNotFound => {
1679 _ = try dir.makePathStatus(t_io, sub_path, permissions);
1679 _ = try dir.createDirPathStatus(t_io, sub_path, permissions);
16801680 return dirOpenDirPosix(t, dir, sub_path, options);
16811681 },
16821682 else => |e| return e,
16831683 };
16841684}
16851685
1686fn dirMakeOpenPathWindows(
1686fn dirCreateDirPathOpenWindows(
16871687 userdata: ?*anyopaque,
16881688 dir: Dir,
16891689 sub_path: []const u8,
16901690 permissions: Dir.Permissions,
16911691 options: Dir.OpenOptions,
1692) Dir.MakeOpenPathError!Dir {
1692) Dir.CreateDirPathOpenError!Dir {
16931693 const t: *Threaded = @ptrCast(@alignCast(userdata));
16941694 const current_thread = Thread.getCurrent(t);
16951695 const w = windows;
......@@ -1795,18 +1795,18 @@ fn dirMakeOpenPathWindows(
17951795 }
17961796}
17971797
1798fn dirMakeOpenPathWasi(
1798fn dirCreateDirPathOpenWasi(
17991799 userdata: ?*anyopaque,
18001800 dir: Dir,
18011801 sub_path: []const u8,
18021802 permissions: Dir.Permissions,
18031803 options: Dir.OpenOptions,
1804) Dir.MakeOpenPathError!Dir {
1804) Dir.CreateDirPathOpenError!Dir {
18051805 const t: *Threaded = @ptrCast(@alignCast(userdata));
18061806 const t_io = ioBasic(t);
18071807 return dirOpenDirWasi(t, dir, sub_path, options) catch |err| switch (err) {
18081808 error.FileNotFound => {
1809 _ = try dir.makePathStatus(t_io, sub_path, permissions);
1809 _ = try dir.createDirPathStatus(t_io, sub_path, permissions);
18101810 return dirOpenDirWasi(t, dir, sub_path, options);
18111811 },
18121812 else => |e| return e,
......@@ -3352,11 +3352,6 @@ pub fn dirOpenDirWindows(
33523352 }
33533353}
33543354
3355const MakeOpenDirAccessMaskWOptions = struct {
3356 no_follow: bool,
3357 create_disposition: u32,
3358};
3359
33603355fn dirClose(userdata: ?*anyopaque, dirs: []const Dir) void {
33613356 const t: *Threaded = @ptrCast(@alignCast(userdata));
33623357 _ = t;
lib/std/fs/test.zig+33-33
......@@ -226,7 +226,7 @@ test "Dir.readLink" {
226226 // test 3: relative path symlink
227227 const parent_file = ".." ++ Dir.path.sep_str ++ "target.txt";
228228 const canonical_parent_file = try ctx.toCanonicalPathSep(parent_file);
229 var subdir = try ctx.dir.makeOpenPath(io, "subdir", .{});
229 var subdir = try ctx.dir.createDirPathOpen(io, "subdir", .{});
230230 defer subdir.close(io);
231231 try setupSymlink(io, subdir, canonical_parent_file, "relative-link.txt", .{});
232232 try testReadLink(io, subdir, canonical_parent_file, "relative-link.txt");
......@@ -411,7 +411,7 @@ test "openDir non-cwd parent '..'" {
411411 var tmp = tmpDir(.{});
412412 defer tmp.cleanup();
413413
414 var subdir = try tmp.dir.makeOpenPath(io, "subdir", .{});
414 var subdir = try tmp.dir.createDirPathOpen(io, "subdir", .{});
415415 defer subdir.close(io);
416416
417417 var dir = try subdir.openDir(io, "..", .{});
......@@ -613,13 +613,13 @@ test "Dir.Iterator but dir is deleted during iteration" {
613613 defer tmp.cleanup();
614614
615615 // Create directory and setup an iterator for it
616 var subdir = try tmp.dir.makeOpenPath(io, "subdir", .{ .open_options = .{ .iterate = true } });
616 var subdir = try tmp.dir.createDirPathOpen(io, "subdir", .{ .open_options = .{ .iterate = true } });
617617 defer subdir.close(io);
618618
619619 var iterator = subdir.iterate();
620620
621621 // Create something to iterate over within the subdir
622 try tmp.dir.makePath(io, "subdir" ++ Dir.path.sep_str ++ "b");
622 try tmp.dir.createDirPath(io, "subdir" ++ Dir.path.sep_str ++ "b");
623623
624624 // Then, before iterating, delete the directory that we're iterating.
625625 // This is a contrived reproduction, but this could happen outside of the program, in another thread, etc.
......@@ -862,13 +862,13 @@ test "file operations on directories" {
862862 }.impl);
863863}
864864
865test "makeOpenPath parent dirs do not exist" {
865test "createDirPathOpen parent dirs do not exist" {
866866 const io = testing.io;
867867
868868 var tmp_dir = tmpDir(.{});
869869 defer tmp_dir.cleanup();
870870
871 var dir = try tmp_dir.dir.makeOpenPath(io, "root_dir/parent_dir/some_dir", .{});
871 var dir = try tmp_dir.dir.createDirPathOpen(io, "root_dir/parent_dir/some_dir", .{});
872872 dir.close(io);
873873
874874 // double check that the full directory structure was created
......@@ -1016,7 +1016,7 @@ test "Dir.rename directory onto non-empty dir" {
10161016
10171017 try ctx.dir.createDir(io, test_dir_path, .default_dir);
10181018
1019 var target_dir = try ctx.dir.makeOpenPath(io, target_dir_path, .{});
1019 var target_dir = try ctx.dir.createDirPathOpen(io, target_dir_path, .{});
10201020 var file = try target_dir.createFile(io, "test_file", .{ .read = true });
10211021 file.close(io);
10221022 target_dir.close(io);
......@@ -1155,9 +1155,9 @@ test "deleteTree does not follow symlinks" {
11551155 var tmp = tmpDir(.{});
11561156 defer tmp.cleanup();
11571157
1158 try tmp.dir.makePath(io, "b");
1158 try tmp.dir.createDirPath(io, "b");
11591159 {
1160 var a = try tmp.dir.makeOpenPath(io, "a", .{});
1160 var a = try tmp.dir.createDirPathOpen(io, "a", .{});
11611161 defer a.close(io);
11621162
11631163 try setupSymlink(io, a, "../b", "b", .{ .is_directory = true });
......@@ -1184,7 +1184,7 @@ test "deleteTree on a symlink" {
11841184 try tmp.dir.access(io, "file", .{});
11851185
11861186 // Symlink to a directory
1187 try tmp.dir.makePath(io, "dir");
1187 try tmp.dir.createDirPath(io, "dir");
11881188 try setupSymlink(io, tmp.dir, "dir", "dirlink", .{ .is_directory = true });
11891189
11901190 try tmp.dir.deleteTree(io, "dirlink");
......@@ -1192,14 +1192,14 @@ test "deleteTree on a symlink" {
11921192 try tmp.dir.access(io, "dir", .{});
11931193}
11941194
1195test "makePath, put some files in it, deleteTree" {
1195test "createDirPath, put some files in it, deleteTree" {
11961196 try testWithAllSupportedPathTypes(struct {
11971197 fn impl(ctx: *TestContext) !void {
11981198 const io = ctx.io;
11991199 const allocator = ctx.arena.allocator();
12001200 const dir_path = try ctx.transformPath("os_test_tmp");
12011201
1202 try ctx.dir.makePath(io, try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c" }));
1202 try ctx.dir.createDirPath(io, try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c" }));
12031203 try ctx.dir.writeFile(io, .{
12041204 .sub_path = try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }),
12051205 .data = "nonsense",
......@@ -1215,14 +1215,14 @@ test "makePath, put some files in it, deleteTree" {
12151215 }.impl);
12161216}
12171217
1218test "makePath, put some files in it, deleteTreeMinStackSize" {
1218test "createDirPath, put some files in it, deleteTreeMinStackSize" {
12191219 try testWithAllSupportedPathTypes(struct {
12201220 fn impl(ctx: *TestContext) !void {
12211221 const io = ctx.io;
12221222 const allocator = ctx.arena.allocator();
12231223 const dir_path = try ctx.transformPath("os_test_tmp");
12241224
1225 try ctx.dir.makePath(io, try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c" }));
1225 try ctx.dir.createDirPath(io, try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c" }));
12261226 try ctx.dir.writeFile(io, .{
12271227 .sub_path = try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }),
12281228 .data = "nonsense",
......@@ -1238,7 +1238,7 @@ test "makePath, put some files in it, deleteTreeMinStackSize" {
12381238 }.impl);
12391239}
12401240
1241test "makePath in a directory that no longer exists" {
1241test "createDirPath in a directory that no longer exists" {
12421242 if (native_os == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir
12431243
12441244 const io = testing.io;
......@@ -1247,10 +1247,10 @@ test "makePath in a directory that no longer exists" {
12471247 defer tmp.cleanup();
12481248 try tmp.parent_dir.deleteTree(io, &tmp.sub_path);
12491249
1250 try expectError(error.FileNotFound, tmp.dir.makePath(io, "sub-path"));
1250 try expectError(error.FileNotFound, tmp.dir.createDirPath(io, "sub-path"));
12511251}
12521252
1253test "makePath but sub_path contains pre-existing file" {
1253test "createDirPath but sub_path contains pre-existing file" {
12541254 const io = testing.io;
12551255
12561256 var tmp = tmpDir(.{});
......@@ -1259,7 +1259,7 @@ test "makePath but sub_path contains pre-existing file" {
12591259 try tmp.dir.createDir(io, "foo", .default_dir);
12601260 try tmp.dir.writeFile(io, .{ .sub_path = "foo/bar", .data = "" });
12611261
1262 try expectError(error.NotDir, tmp.dir.makePath(io, "foo/bar/baz"));
1262 try expectError(error.NotDir, tmp.dir.createDirPath(io, "foo/bar/baz"));
12631263}
12641264
12651265fn expectDir(io: Io, dir: Dir, path: []const u8) !void {
......@@ -1279,7 +1279,7 @@ test "makepath existing directories" {
12791279 try tmpA.createDir(io, "B", .default_dir);
12801280
12811281 const testPath = "A" ++ Dir.path.sep_str ++ "B" ++ Dir.path.sep_str ++ "C";
1282 try tmp.dir.makePath(io, testPath);
1282 try tmp.dir.createDirPath(io, testPath);
12831283
12841284 try expectDir(io, tmp.dir, testPath);
12851285}
......@@ -1293,7 +1293,7 @@ test "makepath through existing valid symlink" {
12931293 try tmp.dir.createDir(io, "realfolder", .default_dir);
12941294 try setupSymlink(io, tmp.dir, "." ++ Dir.path.sep_str ++ "realfolder", "working-symlink", .{});
12951295
1296 try tmp.dir.makePath(io, "working-symlink" ++ Dir.path.sep_str ++ "in-realfolder");
1296 try tmp.dir.createDirPath(io, "working-symlink" ++ Dir.path.sep_str ++ "in-realfolder");
12971297
12981298 try expectDir(io, tmp.dir, "realfolder" ++ Dir.path.sep_str ++ "in-realfolder");
12991299}
......@@ -1309,7 +1309,7 @@ test "makepath relative walks" {
13091309 });
13101310 defer testing.allocator.free(relPath);
13111311
1312 try tmp.dir.makePath(io, relPath);
1312 try tmp.dir.createDirPath(io, relPath);
13131313
13141314 // How .. is handled is different on Windows than non-Windows
13151315 switch (native_os) {
......@@ -1348,7 +1348,7 @@ test "makepath ignores '.'" {
13481348 });
13491349 defer testing.allocator.free(expectedPath);
13501350
1351 try tmp.dir.makePath(io, dotPath);
1351 try tmp.dir.createDirPath(io, dotPath);
13521352
13531353 try expectDir(io, tmp.dir, expectedPath);
13541354}
......@@ -1358,7 +1358,7 @@ fn testFilenameLimits(io: Io, iterable_dir: Dir, maxed_filename: []const u8, max
13581358 {
13591359 try iterable_dir.writeFile(io, .{ .sub_path = maxed_filename, .data = "" });
13601360
1361 var maxed_dir = try iterable_dir.makeOpenPath(io, maxed_dirname, .{});
1361 var maxed_dir = try iterable_dir.createDirPathOpen(io, maxed_dirname, .{});
13621362 defer maxed_dir.close(io);
13631363
13641364 try maxed_dir.writeFile(io, .{ .sub_path = maxed_filename, .data = "" });
......@@ -1511,7 +1511,7 @@ test "access file" {
15111511 const dir_path = try ctx.transformPath("os_test_tmp");
15121512 const file_path = try ctx.transformPath("os_test_tmp" ++ Dir.path.sep_str ++ "file.txt");
15131513
1514 try ctx.dir.makePath(io, dir_path);
1514 try ctx.dir.createDirPath(io, dir_path);
15151515 try expectError(error.FileNotFound, ctx.dir.access(io, file_path, .{}));
15161516
15171517 try ctx.dir.writeFile(io, .{ .sub_path = file_path, .data = "" });
......@@ -1527,7 +1527,7 @@ test "sendfile" {
15271527 var tmp = tmpDir(.{});
15281528 defer tmp.cleanup();
15291529
1530 try tmp.dir.makePath(io, "os_test_tmp");
1530 try tmp.dir.createDirPath(io, "os_test_tmp");
15311531
15321532 var dir = try tmp.dir.openDir(io, "os_test_tmp", .{});
15331533 defer dir.close(io);
......@@ -1574,7 +1574,7 @@ test "sendfile with buffered data" {
15741574 var tmp = tmpDir(.{});
15751575 defer tmp.cleanup();
15761576
1577 try tmp.dir.makePath(io, "os_test_tmp");
1577 try tmp.dir.createDirPath(io, "os_test_tmp");
15781578
15791579 var dir = try tmp.dir.openDir(io, "os_test_tmp", .{});
15801580 defer dir.close(io);
......@@ -1851,7 +1851,7 @@ test "walker" {
18511851 });
18521852
18531853 for (expected_paths.keys()) |key| {
1854 try tmp.dir.makePath(io, key);
1854 try tmp.dir.createDirPath(io, key);
18551855 }
18561856
18571857 var walker = try tmp.dir.walk(testing.allocator);
......@@ -1913,7 +1913,7 @@ test "selective walker, skip entries that start with ." {
19131913 });
19141914
19151915 for (paths_to_create) |path| {
1916 try tmp.dir.makePath(io, path);
1916 try tmp.dir.createDirPath(io, path);
19171917 }
19181918
19191919 var walker = try tmp.dir.walkSelectively(testing.allocator);
......@@ -1959,8 +1959,8 @@ test "walker without fully iterating" {
19591959 // Create 2 directories inside the tmp directory, but then only iterate once before breaking.
19601960 // This ensures that walker doesn't try to close the initial directory when not fully iterating.
19611961
1962 try tmp.dir.makePath(io, "a");
1963 try tmp.dir.makePath(io, "b");
1962 try tmp.dir.createDirPath(io, "a");
1963 try tmp.dir.createDirPath(io, "b");
19641964
19651965 var num_walked: usize = 0;
19661966 while (try walker.next(io)) |_| {
......@@ -2109,8 +2109,8 @@ test "invalid UTF-8/WTF-8 paths" {
21092109
21102110 try expectError(expected_err, ctx.dir.createDir(io, invalid_path, .default_dir));
21112111
2112 try expectError(expected_err, ctx.dir.makePath(io, invalid_path));
2113 try expectError(expected_err, ctx.dir.makeOpenPath(io, invalid_path, .{}));
2112 try expectError(expected_err, ctx.dir.createDirPath(io, invalid_path));
2113 try expectError(expected_err, ctx.dir.createDirPathOpen(io, invalid_path, .{}));
21142114
21152115 try expectError(expected_err, ctx.dir.openDir(io, invalid_path, .{}));
21162116
......@@ -2574,7 +2574,7 @@ test "hard link with different directories" {
25742574 const target_name = "link-target";
25752575 const link_name = "newlink";
25762576
2577 const subdir = try tmp.dir.makeOpenPath(io, "subdir", .{});
2577 const subdir = try tmp.dir.createDirPathOpen(io, "subdir", .{});
25782578
25792579 defer tmp.dir.deleteFile(io, target_name) catch {};
25802580 try tmp.dir.writeFile(io, .{ .sub_path = target_name, .data = "example" });
lib/std/posix.zig+1-1
......@@ -1079,7 +1079,7 @@ pub fn mkdiratZ(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: mode_t) MakeDir
10791079 }
10801080}
10811081
1082pub const MakeDirError = std.Io.Dir.MakeError;
1082pub const MakeDirError = std.Io.Dir.CreateDirError;
10831083
10841084/// Create a directory.
10851085/// `mode` is ignored on Windows and WASI.
lib/std/tar.zig+3-3
......@@ -606,7 +606,7 @@ pub fn pipeToFileSystem(io: Io, dir: Io.Dir, reader: *Io.Reader, options: PipeOp
606606 switch (file.kind) {
607607 .directory => {
608608 if (file_name.len > 0 and !options.exclude_empty_directories) {
609 try dir.makePath(io, file_name);
609 try dir.createDirPath(io, file_name);
610610 }
611611 },
612612 .file => {
......@@ -642,7 +642,7 @@ fn createDirAndFile(io: Io, dir: Io.Dir, file_name: []const u8, permissions: Io.
642642 const fs_file = dir.createFile(io, file_name, .{ .exclusive = true, .permissions = permissions }) catch |err| {
643643 if (err == error.FileNotFound) {
644644 if (std.fs.path.dirname(file_name)) |dir_name| {
645 try dir.makePath(io, dir_name);
645 try dir.createDirPath(io, dir_name);
646646 return try dir.createFile(io, file_name, .{ .exclusive = true, .permissions = permissions });
647647 }
648648 }
......@@ -656,7 +656,7 @@ fn createDirAndSymlink(io: Io, dir: Io.Dir, link_name: []const u8, file_name: []
656656 dir.symLink(io, link_name, file_name, .{}) catch |err| {
657657 if (err == error.FileNotFound) {
658658 if (std.fs.path.dirname(file_name)) |dir_name| {
659 try dir.makePath(io, dir_name);
659 try dir.createDirPath(io, dir_name);
660660 return try dir.symLink(io, link_name, file_name, .{});
661661 }
662662 }
lib/std/testing.zig+3-3
......@@ -635,12 +635,12 @@ pub fn tmpDir(opts: Io.Dir.OpenOptions) TmpDir {
635635 _ = std.fs.base64_encoder.encode(&sub_path, &random_bytes);
636636
637637 const cwd = Io.Dir.cwd();
638 var cache_dir = cwd.makeOpenPath(io, ".zig-cache", .{}) catch
638 var cache_dir = cwd.createDirPathOpen(io, ".zig-cache", .{}) catch
639639 @panic("unable to make tmp dir for testing: unable to make and open .zig-cache dir");
640640 defer cache_dir.close(io);
641 const parent_dir = cache_dir.makeOpenPath(io, "tmp", .{}) catch
641 const parent_dir = cache_dir.createDirPathOpen(io, "tmp", .{}) catch
642642 @panic("unable to make tmp dir for testing: unable to make and open .zig-cache/tmp dir");
643 const dir = parent_dir.makeOpenPath(io, &sub_path, .{ .open_options = opts }) catch
643 const dir = parent_dir.createDirPathOpen(io, &sub_path, .{ .open_options = opts }) catch
644644 @panic("unable to make tmp dir for testing: unable to make and open the tmp dir");
645645
646646 return .{
lib/std/zip.zig+2-2
......@@ -554,13 +554,13 @@ pub const Iterator = struct {
554554 if (filename[filename.len - 1] == '/') {
555555 if (self.uncompressed_size != 0)
556556 return error.ZipBadDirectorySize;
557 try dest.makePath(io, filename[0 .. filename.len - 1]);
557 try dest.createDirPath(io, filename[0 .. filename.len - 1]);
558558 return;
559559 }
560560
561561 const out_file = blk: {
562562 if (std.fs.path.dirname(filename)) |dirname| {
563 var parent_dir = try dest.makeOpenPath(io, dirname, .{});
563 var parent_dir = try dest.createDirPathOpen(io, dirname, .{});
564564 defer parent_dir.close(io);
565565
566566 const basename = std.fs.path.basename(filename);
src/Compilation.zig+17-17
......@@ -832,7 +832,7 @@ pub const Directories = struct {
832832 const nonempty_path = if (path.len == 0) "." else path;
833833 const handle_or_err = switch (thing) {
834834 .@"zig lib" => Io.Dir.cwd().openDir(io, nonempty_path, .{}),
835 .@"global cache", .@"local cache" => Io.Dir.cwd().makeOpenPath(io, nonempty_path, .{}),
835 .@"global cache", .@"local cache" => Io.Dir.cwd().createDirPathOpen(io, nonempty_path, .{}),
836836 };
837837 return .{
838838 .path = if (path.len == 0) null else path,
......@@ -1879,7 +1879,7 @@ pub const CreateDiagnostic = union(enum) {
18791879 pub const CreateCachePath = struct {
18801880 which: enum { local, global },
18811881 sub: []const u8,
1882 err: (Io.Dir.MakeError || Io.Dir.OpenError || Io.Dir.StatFileError),
1882 err: (Io.Dir.CreateDirError || Io.Dir.OpenError || Io.Dir.StatFileError),
18831883 };
18841884 pub fn format(diag: CreateDiagnostic, w: *Writer) Writer.Error!void {
18851885 switch (diag) {
......@@ -2120,7 +2120,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
21202120 cache.* = .{
21212121 .gpa = gpa,
21222122 .io = io,
2123 .manifest_dir = options.dirs.local_cache.handle.makeOpenPath(io, "h", .{}) catch |err| {
2123 .manifest_dir = options.dirs.local_cache.handle.createDirPathOpen(io, "h", .{}) catch |err| {
21242124 return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = "h", .err = err } });
21252125 },
21262126 };
......@@ -2170,7 +2170,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
21702170 // to redundantly happen for each AstGen operation.
21712171 const zir_sub_dir = "z";
21722172
2173 var local_zir_dir = options.dirs.local_cache.handle.makeOpenPath(io, zir_sub_dir, .{}) catch |err| {
2173 var local_zir_dir = options.dirs.local_cache.handle.createDirPathOpen(io, zir_sub_dir, .{}) catch |err| {
21742174 return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = zir_sub_dir, .err = err } });
21752175 };
21762176 errdefer local_zir_dir.close(io);
......@@ -2178,7 +2178,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
21782178 .handle = local_zir_dir,
21792179 .path = try options.dirs.local_cache.join(arena, &.{zir_sub_dir}),
21802180 };
2181 var global_zir_dir = options.dirs.global_cache.handle.makeOpenPath(io, zir_sub_dir, .{}) catch |err| {
2181 var global_zir_dir = options.dirs.global_cache.handle.createDirPathOpen(io, zir_sub_dir, .{}) catch |err| {
21822182 return diag.fail(.{ .create_cache_path = .{ .which = .global, .sub = zir_sub_dir, .err = err } });
21832183 };
21842184 errdefer global_zir_dir.close(io);
......@@ -2449,7 +2449,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic,
24492449 const digest = hash.final();
24502450
24512451 const artifact_sub_dir = "o" ++ fs.path.sep_str ++ digest;
2452 var artifact_dir = options.dirs.local_cache.handle.makeOpenPath(io, artifact_sub_dir, .{}) catch |err| {
2452 var artifact_dir = options.dirs.local_cache.handle.createDirPathOpen(io, artifact_sub_dir, .{}) catch |err| {
24532453 return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = artifact_sub_dir, .err = err } });
24542454 };
24552455 errdefer artifact_dir.close(io);
......@@ -2917,7 +2917,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
29172917 tmp_dir_rand_int = std.crypto.random.int(u64);
29182918 const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int);
29192919 const path = try comp.dirs.local_cache.join(arena, &.{tmp_dir_sub_path});
2920 const handle = comp.dirs.local_cache.handle.makeOpenPath(io, tmp_dir_sub_path, .{}) catch |err| {
2920 const handle = comp.dirs.local_cache.handle.createDirPathOpen(io, tmp_dir_sub_path, .{}) catch |err| {
29212921 return comp.setMiscFailure(.open_output, "failed to create output directory '{s}': {t}", .{ path, err });
29222922 };
29232923 break :d .{ .path = path, .handle = handle };
......@@ -2998,7 +2998,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE
29982998 tmp_dir_rand_int = std.crypto.random.int(u64);
29992999 const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int);
30003000 const path = try comp.dirs.local_cache.join(arena, &.{tmp_dir_sub_path});
3001 const handle = comp.dirs.local_cache.handle.makeOpenPath(io, tmp_dir_sub_path, .{}) catch |err| {
3001 const handle = comp.dirs.local_cache.handle.createDirPathOpen(io, tmp_dir_sub_path, .{}) catch |err| {
30023002 return comp.setMiscFailure(.open_output, "failed to create output directory '{s}': {t}", .{ path, err });
30033003 };
30043004 break :d .{ .path = path, .handle = handle };
......@@ -3437,7 +3437,7 @@ fn renameTmpIntoCache(
34373437 continue;
34383438 },
34393439 error.FileNotFound => {
3440 try cache_directory.handle.makePath(io, "o");
3440 try cache_directory.handle.createDirPath(io, "o");
34413441 continue;
34423442 },
34433443 else => |e| return e,
......@@ -5276,7 +5276,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
52765276 const io = comp.io;
52775277
52785278 const docs_path = comp.resolveEmitPath(comp.emit_docs.?);
5279 var out_dir = docs_path.root_dir.handle.makeOpenPath(io, docs_path.sub_path, .{}) catch |err| {
5279 var out_dir = docs_path.root_dir.handle.createDirPathOpen(io, docs_path.sub_path, .{}) catch |err| {
52805280 return comp.lockAndSetMiscFailure(
52815281 .docs_copy,
52825282 "unable to create output directory '{f}': {s}",
......@@ -5513,7 +5513,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
55135513 assert(docs_bin_file.sub_path.len > 0); // emitted binary is not a directory
55145514
55155515 const docs_path = comp.resolveEmitPath(comp.emit_docs.?);
5516 var out_dir = docs_path.root_dir.handle.makeOpenPath(io, docs_path.sub_path, .{}) catch |err| {
5516 var out_dir = docs_path.root_dir.handle.createDirPathOpen(io, docs_path.sub_path, .{}) catch |err| {
55175517 comp.lockAndSetMiscFailure(
55185518 .docs_copy,
55195519 "unable to create output directory '{f}': {t}",
......@@ -5705,7 +5705,7 @@ pub fn translateC(
57055705 const tmp_basename = std.fmt.hex(std.crypto.random.int(u64));
57065706 const tmp_sub_path = "tmp" ++ fs.path.sep_str ++ tmp_basename;
57075707 const cache_dir = comp.dirs.local_cache.handle;
5708 var cache_tmp_dir = try cache_dir.makeOpenPath(io, tmp_sub_path, .{});
5708 var cache_tmp_dir = try cache_dir.createDirPathOpen(io, tmp_sub_path, .{});
57095709 defer cache_tmp_dir.close(io);
57105710
57115711 const translated_path = try comp.dirs.local_cache.join(arena, &.{ tmp_sub_path, translated_basename });
......@@ -6280,7 +6280,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
62806280 // We can't know the digest until we do the C compiler invocation,
62816281 // so we need a temporary filename.
62826282 const out_obj_path = try comp.tmpFilePath(arena, o_basename);
6283 var zig_cache_tmp_dir = try comp.dirs.local_cache.handle.makeOpenPath(io, "tmp", .{});
6283 var zig_cache_tmp_dir = try comp.dirs.local_cache.handle.createDirPathOpen(io, "tmp", .{});
62846284 defer zig_cache_tmp_dir.close(io);
62856285
62866286 const out_diag_path = if (comp.clang_passthrough_mode or !ext.clangSupportsDiagnostics())
......@@ -6445,7 +6445,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
64456445 // Rename into place.
64466446 const digest = man.final();
64476447 const o_sub_path = try fs.path.join(arena, &[_][]const u8{ "o", &digest });
6448 var o_dir = try comp.dirs.local_cache.handle.makeOpenPath(io, o_sub_path, .{});
6448 var o_dir = try comp.dirs.local_cache.handle.createDirPathOpen(io, o_sub_path, .{});
64496449 defer o_dir.close(io);
64506450 const tmp_basename = fs.path.basename(out_obj_path);
64516451 try Io.Dir.rename(zig_cache_tmp_dir, tmp_basename, o_dir, o_basename, io);
......@@ -6534,7 +6534,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
65346534 const digest = man.final();
65356535
65366536 const o_sub_path = try fs.path.join(arena, &.{ "o", &digest });
6537 var o_dir = try comp.dirs.local_cache.handle.makeOpenPath(io, o_sub_path, .{});
6537 var o_dir = try comp.dirs.local_cache.handle.createDirPathOpen(io, o_sub_path, .{});
65386538 defer o_dir.close(io);
65396539
65406540 const in_rc_path = try comp.dirs.local_cache.join(comp.gpa, &.{
......@@ -6622,7 +6622,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
66226622 const rc_basename_noext = src_basename[0 .. src_basename.len - fs.path.extension(src_basename).len];
66236623
66246624 const digest = if (try man.hit()) man.final() else blk: {
6625 var zig_cache_tmp_dir = try comp.dirs.local_cache.handle.makeOpenPath(io, "tmp", .{});
6625 var zig_cache_tmp_dir = try comp.dirs.local_cache.handle.createDirPathOpen(io, "tmp", .{});
66266626 defer zig_cache_tmp_dir.close(io);
66276627
66286628 const res_filename = try std.fmt.allocPrint(arena, "{s}.res", .{rc_basename_noext});
......@@ -6693,7 +6693,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
66936693 // Rename into place.
66946694 const digest = man.final();
66956695 const o_sub_path = try fs.path.join(arena, &[_][]const u8{ "o", &digest });
6696 var o_dir = try comp.dirs.local_cache.handle.makeOpenPath(io, o_sub_path, .{});
6696 var o_dir = try comp.dirs.local_cache.handle.createDirPathOpen(io, o_sub_path, .{});
66976697 defer o_dir.close(io);
66986698 const tmp_basename = fs.path.basename(out_res_path);
66996699 try Io.Dir.rename(zig_cache_tmp_dir, tmp_basename, o_dir, res_filename, io);
src/Package/Fetch.zig+6-6
......@@ -500,7 +500,7 @@ fn runResource(
500500 var tmp_directory: Cache.Directory = .{
501501 .path = tmp_directory_path,
502502 .handle = handle: {
503 const dir = cache_root.handle.makeOpenPath(io, tmp_dir_sub_path, .{
503 const dir = cache_root.handle.createDirPathOpen(io, tmp_dir_sub_path, .{
504504 .open_options = .{ .iterate = true },
505505 }) catch |err| {
506506 try eb.addRootErrorMessage(.{
......@@ -524,7 +524,7 @@ fn runResource(
524524 if (native_os == .linux and f.job_queue.work_around_btrfs_bug) {
525525 // https://github.com/ziglang/zig/issues/17095
526526 pkg_path.root_dir.handle.close(io);
527 pkg_path.root_dir.handle = cache_root.handle.makeOpenPath(io, tmp_dir_sub_path, .{
527 pkg_path.root_dir.handle = cache_root.handle.createDirPathOpen(io, tmp_dir_sub_path, .{
528528 .open_options = .{ .iterate = true },
529529 }) catch @panic("btrfs workaround failed");
530530 }
......@@ -1366,7 +1366,7 @@ fn unpackGitPack(f: *Fetch, out_dir: Io.Dir, resource: *Resource.Git) anyerror!U
13661366 // we do not attempt to replicate the exact structure of a real .git
13671367 // directory, since that isn't relevant for fetching a package.
13681368 {
1369 var pack_dir = try out_dir.makeOpenPath(io, ".git", .{});
1369 var pack_dir = try out_dir.createDirPathOpen(io, ".git", .{});
13701370 defer pack_dir.close(io);
13711371 var pack_file = try pack_dir.createFile(io, "pkg.pack", .{ .read = true });
13721372 defer pack_file.close(io);
......@@ -1427,7 +1427,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: Io.Dir, tmp_dir: Io.Dir) anyerror!void
14271427 .file => {
14281428 dir.copyFile(entry.path, tmp_dir, entry.path, io, .{}) catch |err| switch (err) {
14291429 error.FileNotFound => {
1430 if (fs.path.dirname(entry.path)) |dirname| try tmp_dir.makePath(io, dirname);
1430 if (fs.path.dirname(entry.path)) |dirname| try tmp_dir.createDirPath(io, dirname);
14311431 try dir.copyFile(entry.path, tmp_dir, entry.path, io, .{});
14321432 },
14331433 else => |e| return e,
......@@ -1440,7 +1440,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: Io.Dir, tmp_dir: Io.Dir) anyerror!void
14401440 // the destination directory, fail with an error instead.
14411441 tmp_dir.symLink(io, link_name, entry.path, .{}) catch |err| switch (err) {
14421442 error.FileNotFound => {
1443 if (fs.path.dirname(entry.path)) |dirname| try tmp_dir.makePath(io, dirname);
1443 if (fs.path.dirname(entry.path)) |dirname| try tmp_dir.createDirPath(io, dirname);
14441444 try tmp_dir.symLink(io, link_name, entry.path, .{});
14451445 },
14461446 else => |e| return e,
......@@ -2250,7 +2250,7 @@ const TestFetchBuilder = struct {
22502250 cache_parent_dir: std.Io.Dir,
22512251 path_or_url: []const u8,
22522252 ) !*Fetch {
2253 const cache_dir = try cache_parent_dir.makeOpenPath(io, "zig-global-cache", .{});
2253 const cache_dir = try cache_parent_dir.createDirPathOpen(io, "zig-global-cache", .{});
22542254
22552255 self.http_client = .{ .allocator = allocator, .io = io };
22562256 self.global_cache_directory = .{ .handle = cache_dir, .path = null };
src/Package/Fetch/git.zig+2-2
......@@ -1720,10 +1720,10 @@ pub fn main() !void {
17201720 var pack_file_reader = pack_file.reader(io, &pack_file_buffer);
17211721
17221722 const commit = try Oid.parse(format, args[3]);
1723 var worktree = try Io.Dir.cwd().makeOpenPath(io, args[4], .{});
1723 var worktree = try Io.Dir.cwd().createDirPathOpen(io, args[4], .{});
17241724 defer worktree.close(io);
17251725
1726 var git_dir = try worktree.makeOpenPath(io, ".git", .{});
1726 var git_dir = try worktree.createDirPathOpen(io, ".git", .{});
17271727 defer git_dir.close(io);
17281728
17291729 std.debug.print("Starting index...\n", .{});
src/libs/freebsd.zig+2-2
......@@ -444,7 +444,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
444444 var cache: Cache = .{
445445 .gpa = gpa,
446446 .io = io,
447 .manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath(io, "h", .{}),
447 .manifest_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, "h", .{}),
448448 };
449449 cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() });
450450 cache.addPrefix(comp.dirs.zig_lib);
......@@ -477,7 +477,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
477477 const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });
478478
479479 var o_directory: Cache.Directory = .{
480 .handle = try comp.dirs.global_cache.handle.makeOpenPath(io, o_sub_path, .{}),
480 .handle = try comp.dirs.global_cache.handle.createDirPathOpen(io, o_sub_path, .{}),
481481 .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}),
482482 };
483483 defer o_directory.handle.close(io);
src/libs/glibc.zig+2-2
......@@ -679,7 +679,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
679679 var cache: Cache = .{
680680 .gpa = gpa,
681681 .io = io,
682 .manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath(io, "h", .{}),
682 .manifest_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, "h", .{}),
683683 };
684684 cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() });
685685 cache.addPrefix(comp.dirs.zig_lib);
......@@ -712,7 +712,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
712712 const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });
713713
714714 var o_directory: Cache.Directory = .{
715 .handle = try comp.dirs.global_cache.handle.makeOpenPath(io, o_sub_path, .{}),
715 .handle = try comp.dirs.global_cache.handle.createDirPathOpen(io, o_sub_path, .{}),
716716 .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}),
717717 };
718718 defer o_directory.handle.close(io);
src/libs/mingw.zig+2-2
......@@ -258,7 +258,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
258258 var cache: Cache = .{
259259 .gpa = gpa,
260260 .io = io,
261 .manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath(io, "h", .{}),
261 .manifest_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, "h", .{}),
262262 };
263263 cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() });
264264 cache.addPrefix(comp.dirs.zig_lib);
......@@ -297,7 +297,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void {
297297
298298 const digest = man.final();
299299 const o_sub_path = try std.fs.path.join(arena, &[_][]const u8{ "o", &digest });
300 var o_dir = try comp.dirs.global_cache.handle.makeOpenPath(io, o_sub_path, .{});
300 var o_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, o_sub_path, .{});
301301 defer o_dir.close(io);
302302
303303 const aro = @import("aro");
src/libs/netbsd.zig+2-2
......@@ -385,7 +385,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
385385 var cache: Cache = .{
386386 .gpa = gpa,
387387 .io = io,
388 .manifest_dir = try comp.dirs.global_cache.handle.makeOpenPath(io, "h", .{}),
388 .manifest_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, "h", .{}),
389389 };
390390 cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() });
391391 cache.addPrefix(comp.dirs.zig_lib);
......@@ -418,7 +418,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye
418418 const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest });
419419
420420 var o_directory: Cache.Directory = .{
421 .handle = try comp.dirs.global_cache.handle.makeOpenPath(io, o_sub_path, .{}),
421 .handle = try comp.dirs.global_cache.handle.createDirPathOpen(io, o_sub_path, .{}),
422422 .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}),
423423 };
424424 defer o_directory.handle.close(io);
src/link/MachO.zig+1-1
......@@ -3319,7 +3319,7 @@ pub fn reopenDebugInfo(self: *MachO) !void {
33193319 );
33203320 defer gpa.free(d_sym_path);
33213321
3322 var d_sym_bundle = try self.base.emit.root_dir.handle.makeOpenPath(io, d_sym_path, .{});
3322 var d_sym_bundle = try self.base.emit.root_dir.handle.createDirPathOpen(io, d_sym_path, .{});
33233323 defer d_sym_bundle.close(io);
33243324
33253325 self.d_sym.?.file = try d_sym_bundle.createFile(io, fs.path.basename(self.base.emit.sub_path), .{
src/main.zig+4-4
......@@ -3381,7 +3381,7 @@ fn buildOutputType(
33813381 const dump_path = try std.fmt.allocPrint(arena, "tmp" ++ sep ++ "{x}-dump-stdin{s}", .{
33823382 std.crypto.random.int(u64), ext.canonicalName(target),
33833383 });
3384 try dirs.local_cache.handle.makePath(io, "tmp");
3384 try dirs.local_cache.handle.createDirPath(io, "tmp");
33853385
33863386 // Note that in one of the happy paths, execve() is used to switch to
33873387 // clang in which case any cleanup logic that exists for this temporary
......@@ -6955,7 +6955,7 @@ fn cmdFetch(
69556955 var global_cache_directory: Directory = l: {
69566956 const p = override_global_cache_dir orelse try introspect.resolveGlobalCacheDir(arena);
69576957 break :l .{
6958 .handle = try Io.Dir.cwd().makeOpenPath(io, p, .{}),
6958 .handle = try Io.Dir.cwd().createDirPathOpen(io, p, .{}),
69596959 .path = p,
69606960 };
69616961 };
......@@ -7201,7 +7201,7 @@ fn createDependenciesModule(
72017201 const rand_int = std.crypto.random.int(u64);
72027202 const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
72037203 {
7204 var tmp_dir = try dirs.local_cache.handle.makeOpenPath(io, tmp_dir_sub_path, .{});
7204 var tmp_dir = try dirs.local_cache.handle.createDirPathOpen(io, tmp_dir_sub_path, .{});
72057205 defer tmp_dir.close(io);
72067206 try tmp_dir.writeFile(io, .{ .sub_path = basename, .data = source });
72077207 }
......@@ -7396,7 +7396,7 @@ const Templates = struct {
73967396 fingerprint: Package.Fingerprint,
73977397 ) !void {
73987398 if (fs.path.dirname(template_path)) |dirname| {
7399 out_dir.makePath(io, dirname) catch |err| {
7399 out_dir.createDirPath(io, dirname) catch |err| {
74007400 fatal("unable to make path '{s}': {t}", .{ dirname, err });
74017401 };
74027402 }