| author | |
| committer | |
| log | a8088306f6223b07ad9b7ae37486bcc9e0ac08c9 |
| tree | 335a999489c68619b496068062a31e572d262e50 |
| parent | 6e0c7ed8659d9d60a59a9dcddd3aed9cd18b659b |
31 files changed, 171 insertions(+), 176 deletions(-)
lib/compiler/build_runner.zig+3-3| ... | ... | @@ -66,12 +66,12 @@ pub fn main() !void { |
| 66 | 66 | |
| 67 | 67 | const local_cache_directory: std.Build.Cache.Directory = .{ |
| 68 | 68 | .path = cache_root, |
| 69 | .handle = try cwd.makeOpenPath(io, cache_root, .{}), | |
| 69 | .handle = try cwd.createDirPathOpen(io, cache_root, .{}), | |
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | const global_cache_directory: std.Build.Cache.Directory = .{ |
| 73 | 73 | .path = global_cache_root, |
| 74 | .handle = try cwd.makeOpenPath(io, global_cache_root, .{}), | |
| 74 | .handle = try cwd.createDirPathOpen(io, global_cache_root, .{}), | |
| 75 | 75 | }; |
| 76 | 76 | |
| 77 | 77 | var graph: std.Build.Graph = .{ |
| ... | ... | @@ -80,7 +80,7 @@ pub fn main() !void { |
| 80 | 80 | .cache = .{ |
| 81 | 81 | .io = io, |
| 82 | 82 | .gpa = arena, |
| 83 | .manifest_dir = try local_cache_directory.handle.makeOpenPath(io, "h", .{}), | |
| 83 | .manifest_dir = try local_cache_directory.handle.createDirPathOpen(io, "h", .{}), | |
| 84 | 84 | }, |
| 85 | 85 | .zig_exe = zig_exe, |
| 86 | 86 | .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 |
| 253 | 253 | if (d.output_name) |path| blk: { |
| 254 | 254 | if (std.mem.eql(u8, path, "-")) break :blk; |
| 255 | 255 | 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| | |
| 257 | 257 | return d.fatal("failed to create path to '{s}': {s}", .{ path, aro.Driver.errorDescription(err) }); |
| 258 | 258 | } |
| 259 | 259 | out_file = Io.Dir.cwd().createFile(io, path, .{}) catch |err| { |
lib/std/Build.zig+3-3| ... | ... | @@ -1701,14 +1701,14 @@ pub fn addCheckFile( |
| 1701 | 1701 | return Step.CheckFile.create(b, file_source, options); |
| 1702 | 1702 | } |
| 1703 | 1703 | |
| 1704 | pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.MakeError || Io.Dir.StatFileError)!void { | |
| 1704 | pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.CreateDirError || Io.Dir.StatFileError)!void { | |
| 1705 | 1705 | const io = b.graph.io; |
| 1706 | 1706 | if (b.verbose) log.info("truncate {s}", .{dest_path}); |
| 1707 | 1707 | const cwd = Io.Dir.cwd(); |
| 1708 | 1708 | var src_file = cwd.createFile(io, dest_path, .{}) catch |err| switch (err) { |
| 1709 | 1709 | error.FileNotFound => blk: { |
| 1710 | 1710 | if (fs.path.dirname(dest_path)) |dirname| { |
| 1711 | try cwd.makePath(io, dirname); | |
| 1711 | try cwd.createDirPath(io, dirname); | |
| 1712 | 1712 | } |
| 1713 | 1713 | break :blk try cwd.createFile(io, dest_path, .{}); |
| 1714 | 1714 | }, |
| ... | ... | @@ -2654,7 +2654,7 @@ pub fn makeTempPath(b: *Build) []const u8 { |
| 2654 | 2654 | const rand_int = std.crypto.random.int(u64); |
| 2655 | 2655 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int); |
| 2656 | 2656 | 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| { | |
| 2658 | 2658 | std.debug.print("unable to make tmp path '{s}': {t}\n", .{ result_path, err }); |
| 2659 | 2659 | }; |
| 2660 | 2660 | return result_path; |
lib/std/Build/Cache.zig+4-4| ... | ... | @@ -1330,7 +1330,7 @@ test "cache file and then recall it" { |
| 1330 | 1330 | var cache: Cache = .{ |
| 1331 | 1331 | .io = io, |
| 1332 | 1332 | .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, .{}), | |
| 1334 | 1334 | }; |
| 1335 | 1335 | cache.addPrefix(.{ .path = null, .handle = tmp.dir }); |
| 1336 | 1336 | defer cache.manifest_dir.close(io); |
| ... | ... | @@ -1396,7 +1396,7 @@ test "check that changing a file makes cache fail" { |
| 1396 | 1396 | var cache: Cache = .{ |
| 1397 | 1397 | .io = io, |
| 1398 | 1398 | .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, .{}), | |
| 1400 | 1400 | }; |
| 1401 | 1401 | cache.addPrefix(.{ .path = null, .handle = tmp.dir }); |
| 1402 | 1402 | defer cache.manifest_dir.close(io); |
| ... | ... | @@ -1456,7 +1456,7 @@ test "no file inputs" { |
| 1456 | 1456 | var cache: Cache = .{ |
| 1457 | 1457 | .io = io, |
| 1458 | 1458 | .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, .{}), | |
| 1460 | 1460 | }; |
| 1461 | 1461 | cache.addPrefix(.{ .path = null, .handle = tmp.dir }); |
| 1462 | 1462 | defer cache.manifest_dir.close(io); |
| ... | ... | @@ -1515,7 +1515,7 @@ test "Manifest with files added after initial hash work" { |
| 1515 | 1515 | var cache: Cache = .{ |
| 1516 | 1516 | .io = io, |
| 1517 | 1517 | .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, .{}), | |
| 1519 | 1519 | }; |
| 1520 | 1520 | cache.addPrefix(.{ .path = null, .handle = tmp.dir }); |
| 1521 | 1521 | defer cache.manifest_dir.close(io); |
lib/std/Build/Cache/Path.zig+4-4| ... | ... | @@ -84,14 +84,14 @@ pub fn openDir( |
| 84 | 84 | return p.root_dir.handle.openDir(io, joined_path, args); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | pub fn makeOpenPath(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.OpenOptions) !Io.Dir { | |
| 87 | pub fn createDirPathOpen(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.OpenOptions) !Io.Dir { | |
| 88 | 88 | var buf: [fs.max_path_bytes]u8 = undefined; |
| 89 | 89 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 90 | 90 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ |
| 91 | 91 | p.sub_path, sub_path, |
| 92 | 92 | }) catch return error.NameTooLong; |
| 93 | 93 | }; |
| 94 | return p.root_dir.handle.makeOpenPath(io, joined_path, opts); | |
| 94 | return p.root_dir.handle.createDirPathOpen(io, joined_path, opts); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | pub 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 |
| 129 | 129 | return p.root_dir.handle.access(io, joined_path, flags); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | pub fn makePath(p: Path, io: Io, sub_path: []const u8) !void { | |
| 132 | pub fn createDirPath(p: Path, io: Io, sub_path: []const u8) !void { | |
| 133 | 133 | var buf: [fs.max_path_bytes]u8 = undefined; |
| 134 | 134 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 135 | 135 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ |
| 136 | 136 | p.sub_path, sub_path, |
| 137 | 137 | }) catch return error.NameTooLong; |
| 138 | 138 | }; |
| 139 | return p.root_dir.handle.makePath(io, joined_path); | |
| 139 | return p.root_dir.handle.createDirPath(io, joined_path); | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | pub 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 |
| 516 | 516 | return s.fail("unable to update file from '{f}' to '{s}': {t}", .{ src_path, dest_path, err }); |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | /// Wrapper around `Io.Dir.makePathStatus` that handles verbose and error output. | |
| 520 | pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.MakePathStatus { | |
| 519 | /// Wrapper around `Io.Dir.createDirPathStatus` that handles verbose and error output. | |
| 520 | pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.CreatePathStatus { | |
| 521 | 521 | const b = s.owner; |
| 522 | 522 | const io = b.graph.io; |
| 523 | 523 | 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| | |
| 525 | 525 | return s.fail("unable to create dir '{s}': {t}", .{ dest_path, err }); |
| 526 | 526 | } |
| 527 | 527 |
lib/std/Build/Step/Compile.zig+2-2| ... | ... | @@ -1669,7 +1669,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { |
| 1669 | 1669 | args_length += arg.len + 1; // +1 to account for null terminator |
| 1670 | 1670 | } |
| 1671 | 1671 | if (args_length >= 30 * 1024) { |
| 1672 | try b.cache_root.handle.makePath(io, "args"); | |
| 1672 | try b.cache_root.handle.createDirPath(io, "args"); | |
| 1673 | 1673 | |
| 1674 | 1674 | const args_to_escape = zig_args.items[2..]; |
| 1675 | 1675 | 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 { |
| 1706 | 1706 | // The args file is already present from a previous run. |
| 1707 | 1707 | } else |err| switch (err) { |
| 1708 | 1708 | error.FileNotFound => { |
| 1709 | try b.cache_root.handle.makePath(io, "tmp"); | |
| 1709 | try b.cache_root.handle.createDirPath(io, "tmp"); | |
| 1710 | 1710 | const rand_int = std.crypto.random.int(u64); |
| 1711 | 1711 | const tmp_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int); |
| 1712 | 1712 | 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 { |
| 258 | 258 | const sub_path = b.pathJoin(&.{ "o", &digest, config_header.include_path }); |
| 259 | 259 | const sub_path_dirname = std.fs.path.dirname(sub_path).?; |
| 260 | 260 | |
| 261 | b.cache_root.handle.makePath(io, sub_path_dirname) catch |err| { | |
| 261 | b.cache_root.handle.createDirPath(io, sub_path_dirname) catch |err| { | |
| 262 | 262 | return step.fail("unable to make path '{f}{s}': {s}", .{ |
| 263 | 263 | b.cache_root, sub_path_dirname, @errorName(err), |
| 264 | 264 | }); |
lib/std/Build/Step/ObjCopy.zig+1-1| ... | ... | @@ -177,7 +177,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 177 | 177 | const cache_path = "o" ++ fs.path.sep_str ++ digest; |
| 178 | 178 | const full_dest_path = try b.cache_root.join(b.allocator, &.{ cache_path, objcopy.basename }); |
| 179 | 179 | 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| { | |
| 181 | 181 | return step.fail("unable to make path {s}: {s}", .{ cache_path, @errorName(err) }); |
| 182 | 182 | }; |
| 183 | 183 |
lib/std/Build/Step/Options.zig+2-2| ... | ... | @@ -477,7 +477,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void { |
| 477 | 477 | } else |outer_err| switch (outer_err) { |
| 478 | 478 | error.FileNotFound => { |
| 479 | 479 | 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| | |
| 481 | 481 | return step.fail("unable to make path '{f}{s}': {t}", .{ b.cache_root, sub_dirname, e }); |
| 482 | 482 | |
| 483 | 483 | const rand_int = std.crypto.random.int(u64); |
| ... | ... | @@ -486,7 +486,7 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void { |
| 486 | 486 | basename; |
| 487 | 487 | const tmp_sub_path_dirname = fs.path.dirname(tmp_sub_path).?; |
| 488 | 488 | |
| 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| { | |
| 490 | 490 | return step.fail("unable to make temporary directory '{f}{s}': {t}", .{ |
| 491 | 491 | b.cache_root, tmp_sub_path_dirname, err, |
| 492 | 492 | }); |
lib/std/Build/Step/Run.zig+3-3| ... | ... | @@ -975,7 +975,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 975 | 975 | .output_directory => output_sub_path, |
| 976 | 976 | else => unreachable, |
| 977 | 977 | }; |
| 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| { | |
| 979 | 979 | return step.fail("unable to make path '{f}{s}': {s}", .{ |
| 980 | 980 | b.cache_root, output_sub_dir_path, @errorName(err), |
| 981 | 981 | }); |
| ... | ... | @@ -1007,7 +1007,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 1007 | 1007 | .output_directory => output_sub_path, |
| 1008 | 1008 | else => unreachable, |
| 1009 | 1009 | }; |
| 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| { | |
| 1011 | 1011 | return step.fail("unable to make path '{f}{s}': {s}", .{ |
| 1012 | 1012 | b.cache_root, output_sub_dir_path, @errorName(err), |
| 1013 | 1013 | }); |
| ... | ... | @@ -1439,7 +1439,7 @@ fn runCommand( |
| 1439 | 1439 | |
| 1440 | 1440 | const sub_path = b.pathJoin(&output_components); |
| 1441 | 1441 | 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| { | |
| 1443 | 1443 | return step.fail("unable to make path '{f}{s}': {s}", .{ |
| 1444 | 1444 | b.cache_root, sub_path_dirname, @errorName(err), |
| 1445 | 1445 | }); |
lib/std/Build/Step/UpdateSourceFiles.zig+1-1| ... | ... | @@ -78,7 +78,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 78 | 78 | var any_miss = false; |
| 79 | 79 | for (usf.output_source_files.items) |output_source_file| { |
| 80 | 80 | 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| { | |
| 82 | 82 | return step.fail("unable to make path '{f}{s}': {t}", .{ b.build_root, dirname, err }); |
| 83 | 83 | }; |
| 84 | 84 | } |
lib/std/Build/Step/WriteFile.zig+4-4| ... | ... | @@ -259,13 +259,13 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 259 | 259 | |
| 260 | 260 | write_file.generated_directory.path = try b.cache_root.join(arena, &.{ "o", &digest }); |
| 261 | 261 | |
| 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| | |
| 263 | 263 | return step.fail("unable to make path '{f}{s}': {t}", .{ b.cache_root, cache_path, err }); |
| 264 | 264 | defer cache_dir.close(io); |
| 265 | 265 | |
| 266 | 266 | for (write_file.files.items) |file| { |
| 267 | 267 | if (fs.path.dirname(file.sub_path)) |dirname| { |
| 268 | cache_dir.makePath(io, dirname) catch |err| { | |
| 268 | cache_dir.createDirPath(io, dirname) catch |err| { | |
| 269 | 269 | return step.fail("unable to make path '{f}{s}{c}{s}': {t}", .{ |
| 270 | 270 | b.cache_root, cache_path, fs.path.sep, dirname, err, |
| 271 | 271 | }); |
| ... | ... | @@ -300,7 +300,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 300 | 300 | const dest_dirname = dir.sub_path; |
| 301 | 301 | |
| 302 | 302 | if (dest_dirname.len != 0) { |
| 303 | cache_dir.makePath(io, dest_dirname) catch |err| { | |
| 303 | cache_dir.createDirPath(io, dest_dirname) catch |err| { | |
| 304 | 304 | return step.fail("unable to make path '{f}{s}{c}{s}': {s}", .{ |
| 305 | 305 | b.cache_root, cache_path, fs.path.sep, dest_dirname, @errorName(err), |
| 306 | 306 | }); |
| ... | ... | @@ -315,7 +315,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 315 | 315 | const src_entry_path = try src_dir_path.join(arena, entry.path); |
| 316 | 316 | const dest_path = b.pathJoin(&.{ dest_dirname, entry.path }); |
| 317 | 317 | switch (entry.kind) { |
| 318 | .directory => try cache_dir.makePath(io, dest_path), | |
| 318 | .directory => try cache_dir.createDirPath(io, dest_path), | |
| 319 | 319 | .file => { |
| 320 | 320 | const prev_status = Io.Dir.updateFile( |
| 321 | 321 | src_entry_path.root_dir.handle, |
lib/std/Io.zig+3-3| ... | ... | @@ -659,9 +659,9 @@ pub const VTable = struct { |
| 659 | 659 | futexWaitUncancelable: *const fn (?*anyopaque, ptr: *const u32, expected: u32) void, |
| 660 | 660 | futexWake: *const fn (?*anyopaque, ptr: *const u32, max_waiters: u32) void, |
| 661 | 661 | |
| 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, | |
| 665 | 665 | dirOpenDir: *const fn (?*anyopaque, Dir, []const u8, Dir.OpenOptions) Dir.OpenError!Dir, |
| 666 | 666 | dirStat: *const fn (?*anyopaque, Dir) Dir.StatError!Dir.Stat, |
| 667 | 667 | 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( |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | if (path.dirname(dest_path)) |dirname| { |
| 593 | try dest_dir.makePath(io, dirname); | |
| 593 | try dest_dir.createDirPath(io, dirname); | |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | 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 |
| 637 | 637 | return buffer[0..n]; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | pub const MakeError = error{ | |
| 640 | pub const CreateDirError = error{ | |
| 641 | 641 | /// In WASI, this error may occur when the file descriptor does |
| 642 | 642 | /// not hold the required rights to create a new directory relative to it. |
| 643 | 643 | AccessDenied, |
| ... | ... | @@ -663,10 +663,10 @@ pub const MakeError = error{ |
| 663 | 663 | /// * On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding. |
| 664 | 664 | /// |
| 665 | 665 | /// Related: |
| 666 | /// * `makePath` | |
| 666 | /// * `createDirPath` | |
| 667 | 667 | /// * `createDirAbsolute` |
| 668 | pub 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); | |
| 668 | pub 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); | |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | /// 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 |
| 677 | 677 | /// On Windows, `absolute_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 678 | 678 | /// On WASI, `absolute_path` should be encoded as valid UTF-8. |
| 679 | 679 | /// On other platforms, `absolute_path` is an opaque sequence of bytes with no particular encoding. |
| 680 | pub fn createDirAbsolute(io: Io, absolute_path: []const u8, permissions: Permissions) MakeError!void { | |
| 680 | pub fn createDirAbsolute(io: Io, absolute_path: []const u8, permissions: Permissions) CreateDirError!void { | |
| 681 | 681 | assert(path.isAbsolute(absolute_path)); |
| 682 | 682 | return createDir(.cwd(), io, absolute_path, permissions); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | test createDirAbsolute {} |
| 686 | 686 | |
| 687 | pub const MakePathError = MakeError || StatFileError; | |
| 687 | pub const CreateDirPathError = CreateDirError || StatFileError; | |
| 688 | 688 | |
| 689 | 689 | /// Creates parent directories with default permissions as necessary to ensure |
| 690 | 690 | /// `sub_path` exists as a directory. |
| ... | ... | @@ -710,27 +710,27 @@ pub const MakePathError = MakeError || StatFileError; |
| 710 | 710 | /// and a `./second` directory. |
| 711 | 711 | /// |
| 712 | 712 | /// See also: |
| 713 | /// * `makePathStatus` | |
| 714 | pub 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` | |
| 714 | pub fn createDirPath(dir: Dir, io: Io, sub_path: []const u8) CreateDirPathError!void { | |
| 715 | _ = try io.vtable.dirCreateDirPath(io.userdata, dir, sub_path, .default_dir); | |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | pub const MakePathStatus = enum { existed, created }; | |
| 718 | pub const CreatePathStatus = enum { existed, created }; | |
| 719 | 719 | |
| 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 | |
| 721 | 721 | /// successfully created. |
| 722 | pub 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); | |
| 722 | pub 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); | |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | pub const MakeOpenPathError = MakeError || OpenError || StatFileError; | |
| 726 | pub const CreateDirPathOpenError = CreateDirError || OpenError || StatFileError; | |
| 727 | 727 | |
| 728 | pub const MakeOpenPathOptions = struct { | |
| 728 | pub const CreateDirPathOpenOptions = struct { | |
| 729 | 729 | open_options: OpenOptions = .{}, |
| 730 | 730 | permissions: Permissions = .default_dir, |
| 731 | 731 | }; |
| 732 | 732 | |
| 733 | /// Performs the equivalent of `makePath` followed by `openDir`, atomically if possible. | |
| 733 | /// Performs the equivalent of `createDirPath` followed by `openDir`, atomically if possible. | |
| 734 | 734 | /// |
| 735 | 735 | /// When this operation is canceled, it may leave the file system in a |
| 736 | 736 | /// partially modified state. |
| ... | ... | @@ -738,8 +738,8 @@ pub const MakeOpenPathOptions = struct { |
| 738 | 738 | /// On Windows, `sub_path` should be encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 739 | 739 | /// On WASI, `sub_path` should be encoded as valid UTF-8. |
| 740 | 740 | /// On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding. |
| 741 | pub 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); | |
| 741 | pub 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); | |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | pub const Stat = File.Stat; |
| ... | ... | @@ -1729,7 +1729,7 @@ pub const AtomicFileOptions = struct { |
| 1729 | 1729 | pub fn atomicFile(parent: Dir, io: Io, dest_path: []const u8, options: AtomicFileOptions) !File.Atomic { |
| 1730 | 1730 | if (path.dirname(dest_path)) |dirname| { |
| 1731 | 1731 | const dir = if (options.make_path) |
| 1732 | try parent.makeOpenPath(io, dirname, .{}) | |
| 1732 | try parent.createDirPathOpen(io, dirname, .{}) | |
| 1733 | 1733 | else |
| 1734 | 1734 | try parent.openDir(io, dirname, .{}); |
| 1735 | 1735 |
lib/std/Io/Kqueue.zig+6-6| ... | ... | @@ -869,9 +869,9 @@ pub fn io(k: *Kqueue) Io { |
| 869 | 869 | .conditionWaitUncancelable = conditionWaitUncancelable, |
| 870 | 870 | .conditionWake = conditionWake, |
| 871 | 871 | |
| 872 | .dirMake = dirMake, | |
| 873 | .dirMakePath = dirMakePath, | |
| 874 | .dirMakeOpenPath = dirMakeOpenPath, | |
| 872 | .dirCreateDir = dirCreateDir, | |
| 873 | .dirCreateDirPath = dirCreateDirPath, | |
| 874 | .dirCreateDirPathOpen = dirCreateDirPathOpen, | |
| 875 | 875 | .dirStat = dirStat, |
| 876 | 876 | .dirStatFile = dirStatFile, |
| 877 | 877 | |
| ... | ... | @@ -1114,7 +1114,7 @@ fn conditionWake(userdata: ?*anyopaque, cond: *Io.Condition, wake: Io.Condition. |
| 1114 | 1114 | k.yield(waiting_fiber, .reschedule); |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | fn dirMake(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.MakeError!void { | |
| 1117 | fn dirCreateDir(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.CreateDirError!void { | |
| 1118 | 1118 | const k: *Kqueue = @ptrCast(@alignCast(userdata)); |
| 1119 | 1119 | _ = k; |
| 1120 | 1120 | _ = dir; |
| ... | ... | @@ -1122,7 +1122,7 @@ fn dirMake(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode |
| 1122 | 1122 | _ = mode; |
| 1123 | 1123 | @panic("TODO"); |
| 1124 | 1124 | } |
| 1125 | fn dirMakePath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.MakeError!void { | |
| 1125 | fn dirCreateDirPath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir.Mode) Dir.CreateDirError!void { | |
| 1126 | 1126 | const k: *Kqueue = @ptrCast(@alignCast(userdata)); |
| 1127 | 1127 | _ = k; |
| 1128 | 1128 | _ = dir; |
| ... | ... | @@ -1130,7 +1130,7 @@ fn dirMakePath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, mode: Dir. |
| 1130 | 1130 | _ = mode; |
| 1131 | 1131 | @panic("TODO"); |
| 1132 | 1132 | } |
| 1133 | fn dirMakeOpenPath(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.OpenOptions) Dir.MakeOpenPathError!Dir { | |
| 1133 | fn dirCreateDirPathOpen(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, options: Dir.OpenOptions) Dir.CreateDirPathOpenError!Dir { | |
| 1134 | 1134 | const k: *Kqueue = @ptrCast(@alignCast(userdata)); |
| 1135 | 1135 | _ = k; |
| 1136 | 1136 | _ = dir; |
lib/std/Io/Threaded.zig+30-35| ... | ... | @@ -711,9 +711,9 @@ pub fn io(t: *Threaded) Io { |
| 711 | 711 | .futexWaitUncancelable = futexWaitUncancelable, |
| 712 | 712 | .futexWake = futexWake, |
| 713 | 713 | |
| 714 | .dirMake = dirMake, | |
| 715 | .dirMakePath = dirMakePath, | |
| 716 | .dirMakeOpenPath = dirMakeOpenPath, | |
| 714 | .dirCreateDir = dirCreateDir, | |
| 715 | .dirCreateDirPath = dirCreateDirPath, | |
| 716 | .dirCreateDirPathOpen = dirCreateDirPathOpen, | |
| 717 | 717 | .dirStat = dirStat, |
| 718 | 718 | .dirStatFile = dirStatFile, |
| 719 | 719 | .dirAccess = dirAccess, |
| ... | ... | @@ -846,9 +846,9 @@ pub fn ioBasic(t: *Threaded) Io { |
| 846 | 846 | .futexWaitUncancelable = futexWaitUncancelable, |
| 847 | 847 | .futexWake = futexWake, |
| 848 | 848 | |
| 849 | .dirMake = dirMake, | |
| 850 | .dirMakePath = dirMakePath, | |
| 851 | .dirMakeOpenPath = dirMakeOpenPath, | |
| 849 | .dirCreateDir = dirCreateDir, | |
| 850 | .dirCreateDirPath = dirCreateDirPath, | |
| 851 | .dirCreateDirPathOpen = dirCreateDirPathOpen, | |
| 852 | 852 | .dirStat = dirStat, |
| 853 | 853 | .dirStatFile = dirStatFile, |
| 854 | 854 | .dirAccess = dirAccess, |
| ... | ... | @@ -1507,13 +1507,13 @@ fn futexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void { |
| 1507 | 1507 | } |
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | const dirMake = switch (native_os) { | |
| 1511 | .windows => dirMakeWindows, | |
| 1512 | .wasi => dirMakeWasi, | |
| 1513 | else => dirMakePosix, | |
| 1510 | const dirCreateDir = switch (native_os) { | |
| 1511 | .windows => dirCreateDirWindows, | |
| 1512 | .wasi => dirCreateDirWasi, | |
| 1513 | else => dirCreateDirPosix, | |
| 1514 | 1514 | }; |
| 1515 | 1515 | |
| 1516 | fn dirMakePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.MakeError!void { | |
| 1516 | fn dirCreateDirPosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void { | |
| 1517 | 1517 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1518 | 1518 | const current_thread = Thread.getCurrent(t); |
| 1519 | 1519 | |
| ... | ... | @@ -1559,8 +1559,8 @@ fn dirMakePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissio |
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | fn 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); | |
| 1562 | fn 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); | |
| 1564 | 1564 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1565 | 1565 | const current_thread = Thread.getCurrent(t); |
| 1566 | 1566 | try current_thread.beginSyscall(); |
| ... | ... | @@ -1601,7 +1601,7 @@ fn dirMakeWasi(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permission |
| 1601 | 1601 | } |
| 1602 | 1602 | } |
| 1603 | 1603 | |
| 1604 | fn dirMakeWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.MakeError!void { | |
| 1604 | fn dirCreateDirWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permissions: Dir.Permissions) Dir.CreateDirError!void { | |
| 1605 | 1605 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1606 | 1606 | const current_thread = Thread.getCurrent(t); |
| 1607 | 1607 | try current_thread.checkCancel(); |
| ... | ... | @@ -1627,19 +1627,19 @@ fn dirMakeWindows(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, permiss |
| 1627 | 1627 | windows.CloseHandle(sub_dir_handle); |
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | fn dirMakePath( | |
| 1630 | fn dirCreateDirPath( | |
| 1631 | 1631 | userdata: ?*anyopaque, |
| 1632 | 1632 | dir: Dir, |
| 1633 | 1633 | sub_path: []const u8, |
| 1634 | 1634 | permissions: Dir.Permissions, |
| 1635 | ) Dir.MakePathError!Dir.MakePathStatus { | |
| 1635 | ) Dir.CreateDirPathError!Dir.CreatePathStatus { | |
| 1636 | 1636 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1637 | 1637 | |
| 1638 | 1638 | var it = std.fs.path.componentIterator(sub_path); |
| 1639 | var status: Dir.MakePathStatus = .existed; | |
| 1639 | var status: Dir.CreatePathStatus = .existed; | |
| 1640 | 1640 | var component = it.last() orelse return error.BadPathName; |
| 1641 | 1641 | while (true) { |
| 1642 | if (dirMake(t, dir, component.path, permissions)) |_| { | |
| 1642 | if (dirCreateDir(t, dir, component.path, permissions)) |_| { | |
| 1643 | 1643 | status = .created; |
| 1644 | 1644 | } else |err| switch (err) { |
| 1645 | 1645 | error.PathAlreadyExists => { |
| ... | ... | @@ -1659,37 +1659,37 @@ fn dirMakePath( |
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | const dirMakeOpenPath = switch (native_os) { | |
| 1663 | .windows => dirMakeOpenPathWindows, | |
| 1664 | .wasi => dirMakeOpenPathWasi, | |
| 1665 | else => dirMakeOpenPathPosix, | |
| 1662 | const dirCreateDirPathOpen = switch (native_os) { | |
| 1663 | .windows => dirCreateDirPathOpenWindows, | |
| 1664 | .wasi => dirCreateDirPathOpenWasi, | |
| 1665 | else => dirCreateDirPathOpenPosix, | |
| 1666 | 1666 | }; |
| 1667 | 1667 | |
| 1668 | fn dirMakeOpenPathPosix( | |
| 1668 | fn dirCreateDirPathOpenPosix( | |
| 1669 | 1669 | userdata: ?*anyopaque, |
| 1670 | 1670 | dir: Dir, |
| 1671 | 1671 | sub_path: []const u8, |
| 1672 | 1672 | permissions: Dir.Permissions, |
| 1673 | 1673 | options: Dir.OpenOptions, |
| 1674 | ) Dir.MakeOpenPathError!Dir { | |
| 1674 | ) Dir.CreateDirPathOpenError!Dir { | |
| 1675 | 1675 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1676 | 1676 | const t_io = ioBasic(t); |
| 1677 | 1677 | return dirOpenDirPosix(t, dir, sub_path, options) catch |err| switch (err) { |
| 1678 | 1678 | error.FileNotFound => { |
| 1679 | _ = try dir.makePathStatus(t_io, sub_path, permissions); | |
| 1679 | _ = try dir.createDirPathStatus(t_io, sub_path, permissions); | |
| 1680 | 1680 | return dirOpenDirPosix(t, dir, sub_path, options); |
| 1681 | 1681 | }, |
| 1682 | 1682 | else => |e| return e, |
| 1683 | 1683 | }; |
| 1684 | 1684 | } |
| 1685 | 1685 | |
| 1686 | fn dirMakeOpenPathWindows( | |
| 1686 | fn dirCreateDirPathOpenWindows( | |
| 1687 | 1687 | userdata: ?*anyopaque, |
| 1688 | 1688 | dir: Dir, |
| 1689 | 1689 | sub_path: []const u8, |
| 1690 | 1690 | permissions: Dir.Permissions, |
| 1691 | 1691 | options: Dir.OpenOptions, |
| 1692 | ) Dir.MakeOpenPathError!Dir { | |
| 1692 | ) Dir.CreateDirPathOpenError!Dir { | |
| 1693 | 1693 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1694 | 1694 | const current_thread = Thread.getCurrent(t); |
| 1695 | 1695 | const w = windows; |
| ... | ... | @@ -1795,18 +1795,18 @@ fn dirMakeOpenPathWindows( |
| 1795 | 1795 | } |
| 1796 | 1796 | } |
| 1797 | 1797 | |
| 1798 | fn dirMakeOpenPathWasi( | |
| 1798 | fn dirCreateDirPathOpenWasi( | |
| 1799 | 1799 | userdata: ?*anyopaque, |
| 1800 | 1800 | dir: Dir, |
| 1801 | 1801 | sub_path: []const u8, |
| 1802 | 1802 | permissions: Dir.Permissions, |
| 1803 | 1803 | options: Dir.OpenOptions, |
| 1804 | ) Dir.MakeOpenPathError!Dir { | |
| 1804 | ) Dir.CreateDirPathOpenError!Dir { | |
| 1805 | 1805 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 1806 | 1806 | const t_io = ioBasic(t); |
| 1807 | 1807 | return dirOpenDirWasi(t, dir, sub_path, options) catch |err| switch (err) { |
| 1808 | 1808 | error.FileNotFound => { |
| 1809 | _ = try dir.makePathStatus(t_io, sub_path, permissions); | |
| 1809 | _ = try dir.createDirPathStatus(t_io, sub_path, permissions); | |
| 1810 | 1810 | return dirOpenDirWasi(t, dir, sub_path, options); |
| 1811 | 1811 | }, |
| 1812 | 1812 | else => |e| return e, |
| ... | ... | @@ -3352,11 +3352,6 @@ pub fn dirOpenDirWindows( |
| 3352 | 3352 | } |
| 3353 | 3353 | } |
| 3354 | 3354 | |
| 3355 | const MakeOpenDirAccessMaskWOptions = struct { | |
| 3356 | no_follow: bool, | |
| 3357 | create_disposition: u32, | |
| 3358 | }; | |
| 3359 | ||
| 3360 | 3355 | fn dirClose(userdata: ?*anyopaque, dirs: []const Dir) void { |
| 3361 | 3356 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 3362 | 3357 | _ = t; |
lib/std/fs/test.zig+33-33| ... | ... | @@ -226,7 +226,7 @@ test "Dir.readLink" { |
| 226 | 226 | // test 3: relative path symlink |
| 227 | 227 | const parent_file = ".." ++ Dir.path.sep_str ++ "target.txt"; |
| 228 | 228 | 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", .{}); | |
| 230 | 230 | defer subdir.close(io); |
| 231 | 231 | try setupSymlink(io, subdir, canonical_parent_file, "relative-link.txt", .{}); |
| 232 | 232 | try testReadLink(io, subdir, canonical_parent_file, "relative-link.txt"); |
| ... | ... | @@ -411,7 +411,7 @@ test "openDir non-cwd parent '..'" { |
| 411 | 411 | var tmp = tmpDir(.{}); |
| 412 | 412 | defer tmp.cleanup(); |
| 413 | 413 | |
| 414 | var subdir = try tmp.dir.makeOpenPath(io, "subdir", .{}); | |
| 414 | var subdir = try tmp.dir.createDirPathOpen(io, "subdir", .{}); | |
| 415 | 415 | defer subdir.close(io); |
| 416 | 416 | |
| 417 | 417 | var dir = try subdir.openDir(io, "..", .{}); |
| ... | ... | @@ -613,13 +613,13 @@ test "Dir.Iterator but dir is deleted during iteration" { |
| 613 | 613 | defer tmp.cleanup(); |
| 614 | 614 | |
| 615 | 615 | // 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 } }); | |
| 617 | 617 | defer subdir.close(io); |
| 618 | 618 | |
| 619 | 619 | var iterator = subdir.iterate(); |
| 620 | 620 | |
| 621 | 621 | // 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"); | |
| 623 | 623 | |
| 624 | 624 | // Then, before iterating, delete the directory that we're iterating. |
| 625 | 625 | // 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" { |
| 862 | 862 | }.impl); |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | test "makeOpenPath parent dirs do not exist" { | |
| 865 | test "createDirPathOpen parent dirs do not exist" { | |
| 866 | 866 | const io = testing.io; |
| 867 | 867 | |
| 868 | 868 | var tmp_dir = tmpDir(.{}); |
| 869 | 869 | defer tmp_dir.cleanup(); |
| 870 | 870 | |
| 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", .{}); | |
| 872 | 872 | dir.close(io); |
| 873 | 873 | |
| 874 | 874 | // double check that the full directory structure was created |
| ... | ... | @@ -1016,7 +1016,7 @@ test "Dir.rename directory onto non-empty dir" { |
| 1016 | 1016 | |
| 1017 | 1017 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 1018 | 1018 | |
| 1019 | var target_dir = try ctx.dir.makeOpenPath(io, target_dir_path, .{}); | |
| 1019 | var target_dir = try ctx.dir.createDirPathOpen(io, target_dir_path, .{}); | |
| 1020 | 1020 | var file = try target_dir.createFile(io, "test_file", .{ .read = true }); |
| 1021 | 1021 | file.close(io); |
| 1022 | 1022 | target_dir.close(io); |
| ... | ... | @@ -1155,9 +1155,9 @@ test "deleteTree does not follow symlinks" { |
| 1155 | 1155 | var tmp = tmpDir(.{}); |
| 1156 | 1156 | defer tmp.cleanup(); |
| 1157 | 1157 | |
| 1158 | try tmp.dir.makePath(io, "b"); | |
| 1158 | try tmp.dir.createDirPath(io, "b"); | |
| 1159 | 1159 | { |
| 1160 | var a = try tmp.dir.makeOpenPath(io, "a", .{}); | |
| 1160 | var a = try tmp.dir.createDirPathOpen(io, "a", .{}); | |
| 1161 | 1161 | defer a.close(io); |
| 1162 | 1162 | |
| 1163 | 1163 | try setupSymlink(io, a, "../b", "b", .{ .is_directory = true }); |
| ... | ... | @@ -1184,7 +1184,7 @@ test "deleteTree on a symlink" { |
| 1184 | 1184 | try tmp.dir.access(io, "file", .{}); |
| 1185 | 1185 | |
| 1186 | 1186 | // Symlink to a directory |
| 1187 | try tmp.dir.makePath(io, "dir"); | |
| 1187 | try tmp.dir.createDirPath(io, "dir"); | |
| 1188 | 1188 | try setupSymlink(io, tmp.dir, "dir", "dirlink", .{ .is_directory = true }); |
| 1189 | 1189 | |
| 1190 | 1190 | try tmp.dir.deleteTree(io, "dirlink"); |
| ... | ... | @@ -1192,14 +1192,14 @@ test "deleteTree on a symlink" { |
| 1192 | 1192 | try tmp.dir.access(io, "dir", .{}); |
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | test "makePath, put some files in it, deleteTree" { | |
| 1195 | test "createDirPath, put some files in it, deleteTree" { | |
| 1196 | 1196 | try testWithAllSupportedPathTypes(struct { |
| 1197 | 1197 | fn impl(ctx: *TestContext) !void { |
| 1198 | 1198 | const io = ctx.io; |
| 1199 | 1199 | const allocator = ctx.arena.allocator(); |
| 1200 | 1200 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| 1201 | 1201 | |
| 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" })); | |
| 1203 | 1203 | try ctx.dir.writeFile(io, .{ |
| 1204 | 1204 | .sub_path = try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }), |
| 1205 | 1205 | .data = "nonsense", |
| ... | ... | @@ -1215,14 +1215,14 @@ test "makePath, put some files in it, deleteTree" { |
| 1215 | 1215 | }.impl); |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | test "makePath, put some files in it, deleteTreeMinStackSize" { | |
| 1218 | test "createDirPath, put some files in it, deleteTreeMinStackSize" { | |
| 1219 | 1219 | try testWithAllSupportedPathTypes(struct { |
| 1220 | 1220 | fn impl(ctx: *TestContext) !void { |
| 1221 | 1221 | const io = ctx.io; |
| 1222 | 1222 | const allocator = ctx.arena.allocator(); |
| 1223 | 1223 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| 1224 | 1224 | |
| 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" })); | |
| 1226 | 1226 | try ctx.dir.writeFile(io, .{ |
| 1227 | 1227 | .sub_path = try Dir.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }), |
| 1228 | 1228 | .data = "nonsense", |
| ... | ... | @@ -1238,7 +1238,7 @@ test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 1238 | 1238 | }.impl); |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | test "makePath in a directory that no longer exists" { | |
| 1241 | test "createDirPath in a directory that no longer exists" { | |
| 1242 | 1242 | if (native_os == .windows) return error.SkipZigTest; // Windows returns FileBusy if attempting to remove an open dir |
| 1243 | 1243 | |
| 1244 | 1244 | const io = testing.io; |
| ... | ... | @@ -1247,10 +1247,10 @@ test "makePath in a directory that no longer exists" { |
| 1247 | 1247 | defer tmp.cleanup(); |
| 1248 | 1248 | try tmp.parent_dir.deleteTree(io, &tmp.sub_path); |
| 1249 | 1249 | |
| 1250 | try expectError(error.FileNotFound, tmp.dir.makePath(io, "sub-path")); | |
| 1250 | try expectError(error.FileNotFound, tmp.dir.createDirPath(io, "sub-path")); | |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | test "makePath but sub_path contains pre-existing file" { | |
| 1253 | test "createDirPath but sub_path contains pre-existing file" { | |
| 1254 | 1254 | const io = testing.io; |
| 1255 | 1255 | |
| 1256 | 1256 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -1259,7 +1259,7 @@ test "makePath but sub_path contains pre-existing file" { |
| 1259 | 1259 | try tmp.dir.createDir(io, "foo", .default_dir); |
| 1260 | 1260 | try tmp.dir.writeFile(io, .{ .sub_path = "foo/bar", .data = "" }); |
| 1261 | 1261 | |
| 1262 | try expectError(error.NotDir, tmp.dir.makePath(io, "foo/bar/baz")); | |
| 1262 | try expectError(error.NotDir, tmp.dir.createDirPath(io, "foo/bar/baz")); | |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | fn expectDir(io: Io, dir: Dir, path: []const u8) !void { |
| ... | ... | @@ -1279,7 +1279,7 @@ test "makepath existing directories" { |
| 1279 | 1279 | try tmpA.createDir(io, "B", .default_dir); |
| 1280 | 1280 | |
| 1281 | 1281 | 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); | |
| 1283 | 1283 | |
| 1284 | 1284 | try expectDir(io, tmp.dir, testPath); |
| 1285 | 1285 | } |
| ... | ... | @@ -1293,7 +1293,7 @@ test "makepath through existing valid symlink" { |
| 1293 | 1293 | try tmp.dir.createDir(io, "realfolder", .default_dir); |
| 1294 | 1294 | try setupSymlink(io, tmp.dir, "." ++ Dir.path.sep_str ++ "realfolder", "working-symlink", .{}); |
| 1295 | 1295 | |
| 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"); | |
| 1297 | 1297 | |
| 1298 | 1298 | try expectDir(io, tmp.dir, "realfolder" ++ Dir.path.sep_str ++ "in-realfolder"); |
| 1299 | 1299 | } |
| ... | ... | @@ -1309,7 +1309,7 @@ test "makepath relative walks" { |
| 1309 | 1309 | }); |
| 1310 | 1310 | defer testing.allocator.free(relPath); |
| 1311 | 1311 | |
| 1312 | try tmp.dir.makePath(io, relPath); | |
| 1312 | try tmp.dir.createDirPath(io, relPath); | |
| 1313 | 1313 | |
| 1314 | 1314 | // How .. is handled is different on Windows than non-Windows |
| 1315 | 1315 | switch (native_os) { |
| ... | ... | @@ -1348,7 +1348,7 @@ test "makepath ignores '.'" { |
| 1348 | 1348 | }); |
| 1349 | 1349 | defer testing.allocator.free(expectedPath); |
| 1350 | 1350 | |
| 1351 | try tmp.dir.makePath(io, dotPath); | |
| 1351 | try tmp.dir.createDirPath(io, dotPath); | |
| 1352 | 1352 | |
| 1353 | 1353 | try expectDir(io, tmp.dir, expectedPath); |
| 1354 | 1354 | } |
| ... | ... | @@ -1358,7 +1358,7 @@ fn testFilenameLimits(io: Io, iterable_dir: Dir, maxed_filename: []const u8, max |
| 1358 | 1358 | { |
| 1359 | 1359 | try iterable_dir.writeFile(io, .{ .sub_path = maxed_filename, .data = "" }); |
| 1360 | 1360 | |
| 1361 | var maxed_dir = try iterable_dir.makeOpenPath(io, maxed_dirname, .{}); | |
| 1361 | var maxed_dir = try iterable_dir.createDirPathOpen(io, maxed_dirname, .{}); | |
| 1362 | 1362 | defer maxed_dir.close(io); |
| 1363 | 1363 | |
| 1364 | 1364 | try maxed_dir.writeFile(io, .{ .sub_path = maxed_filename, .data = "" }); |
| ... | ... | @@ -1511,7 +1511,7 @@ test "access file" { |
| 1511 | 1511 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| 1512 | 1512 | const file_path = try ctx.transformPath("os_test_tmp" ++ Dir.path.sep_str ++ "file.txt"); |
| 1513 | 1513 | |
| 1514 | try ctx.dir.makePath(io, dir_path); | |
| 1514 | try ctx.dir.createDirPath(io, dir_path); | |
| 1515 | 1515 | try expectError(error.FileNotFound, ctx.dir.access(io, file_path, .{})); |
| 1516 | 1516 | |
| 1517 | 1517 | try ctx.dir.writeFile(io, .{ .sub_path = file_path, .data = "" }); |
| ... | ... | @@ -1527,7 +1527,7 @@ test "sendfile" { |
| 1527 | 1527 | var tmp = tmpDir(.{}); |
| 1528 | 1528 | defer tmp.cleanup(); |
| 1529 | 1529 | |
| 1530 | try tmp.dir.makePath(io, "os_test_tmp"); | |
| 1530 | try tmp.dir.createDirPath(io, "os_test_tmp"); | |
| 1531 | 1531 | |
| 1532 | 1532 | var dir = try tmp.dir.openDir(io, "os_test_tmp", .{}); |
| 1533 | 1533 | defer dir.close(io); |
| ... | ... | @@ -1574,7 +1574,7 @@ test "sendfile with buffered data" { |
| 1574 | 1574 | var tmp = tmpDir(.{}); |
| 1575 | 1575 | defer tmp.cleanup(); |
| 1576 | 1576 | |
| 1577 | try tmp.dir.makePath(io, "os_test_tmp"); | |
| 1577 | try tmp.dir.createDirPath(io, "os_test_tmp"); | |
| 1578 | 1578 | |
| 1579 | 1579 | var dir = try tmp.dir.openDir(io, "os_test_tmp", .{}); |
| 1580 | 1580 | defer dir.close(io); |
| ... | ... | @@ -1851,7 +1851,7 @@ test "walker" { |
| 1851 | 1851 | }); |
| 1852 | 1852 | |
| 1853 | 1853 | for (expected_paths.keys()) |key| { |
| 1854 | try tmp.dir.makePath(io, key); | |
| 1854 | try tmp.dir.createDirPath(io, key); | |
| 1855 | 1855 | } |
| 1856 | 1856 | |
| 1857 | 1857 | var walker = try tmp.dir.walk(testing.allocator); |
| ... | ... | @@ -1913,7 +1913,7 @@ test "selective walker, skip entries that start with ." { |
| 1913 | 1913 | }); |
| 1914 | 1914 | |
| 1915 | 1915 | for (paths_to_create) |path| { |
| 1916 | try tmp.dir.makePath(io, path); | |
| 1916 | try tmp.dir.createDirPath(io, path); | |
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | var walker = try tmp.dir.walkSelectively(testing.allocator); |
| ... | ... | @@ -1959,8 +1959,8 @@ test "walker without fully iterating" { |
| 1959 | 1959 | // Create 2 directories inside the tmp directory, but then only iterate once before breaking. |
| 1960 | 1960 | // This ensures that walker doesn't try to close the initial directory when not fully iterating. |
| 1961 | 1961 | |
| 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"); | |
| 1964 | 1964 | |
| 1965 | 1965 | var num_walked: usize = 0; |
| 1966 | 1966 | while (try walker.next(io)) |_| { |
| ... | ... | @@ -2109,8 +2109,8 @@ test "invalid UTF-8/WTF-8 paths" { |
| 2109 | 2109 | |
| 2110 | 2110 | try expectError(expected_err, ctx.dir.createDir(io, invalid_path, .default_dir)); |
| 2111 | 2111 | |
| 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, .{})); | |
| 2114 | 2114 | |
| 2115 | 2115 | try expectError(expected_err, ctx.dir.openDir(io, invalid_path, .{})); |
| 2116 | 2116 | |
| ... | ... | @@ -2574,7 +2574,7 @@ test "hard link with different directories" { |
| 2574 | 2574 | const target_name = "link-target"; |
| 2575 | 2575 | const link_name = "newlink"; |
| 2576 | 2576 | |
| 2577 | const subdir = try tmp.dir.makeOpenPath(io, "subdir", .{}); | |
| 2577 | const subdir = try tmp.dir.createDirPathOpen(io, "subdir", .{}); | |
| 2578 | 2578 | |
| 2579 | 2579 | defer tmp.dir.deleteFile(io, target_name) catch {}; |
| 2580 | 2580 | 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 |
| 1079 | 1079 | } |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | pub const MakeDirError = std.Io.Dir.MakeError; | |
| 1082 | pub const MakeDirError = std.Io.Dir.CreateDirError; | |
| 1083 | 1083 | |
| 1084 | 1084 | /// Create a directory. |
| 1085 | 1085 | /// `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 |
| 606 | 606 | switch (file.kind) { |
| 607 | 607 | .directory => { |
| 608 | 608 | if (file_name.len > 0 and !options.exclude_empty_directories) { |
| 609 | try dir.makePath(io, file_name); | |
| 609 | try dir.createDirPath(io, file_name); | |
| 610 | 610 | } |
| 611 | 611 | }, |
| 612 | 612 | .file => { |
| ... | ... | @@ -642,7 +642,7 @@ fn createDirAndFile(io: Io, dir: Io.Dir, file_name: []const u8, permissions: Io. |
| 642 | 642 | const fs_file = dir.createFile(io, file_name, .{ .exclusive = true, .permissions = permissions }) catch |err| { |
| 643 | 643 | if (err == error.FileNotFound) { |
| 644 | 644 | if (std.fs.path.dirname(file_name)) |dir_name| { |
| 645 | try dir.makePath(io, dir_name); | |
| 645 | try dir.createDirPath(io, dir_name); | |
| 646 | 646 | return try dir.createFile(io, file_name, .{ .exclusive = true, .permissions = permissions }); |
| 647 | 647 | } |
| 648 | 648 | } |
| ... | ... | @@ -656,7 +656,7 @@ fn createDirAndSymlink(io: Io, dir: Io.Dir, link_name: []const u8, file_name: [] |
| 656 | 656 | dir.symLink(io, link_name, file_name, .{}) catch |err| { |
| 657 | 657 | if (err == error.FileNotFound) { |
| 658 | 658 | if (std.fs.path.dirname(file_name)) |dir_name| { |
| 659 | try dir.makePath(io, dir_name); | |
| 659 | try dir.createDirPath(io, dir_name); | |
| 660 | 660 | return try dir.symLink(io, link_name, file_name, .{}); |
| 661 | 661 | } |
| 662 | 662 | } |
lib/std/testing.zig+3-3| ... | ... | @@ -635,12 +635,12 @@ pub fn tmpDir(opts: Io.Dir.OpenOptions) TmpDir { |
| 635 | 635 | _ = std.fs.base64_encoder.encode(&sub_path, &random_bytes); |
| 636 | 636 | |
| 637 | 637 | 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 | |
| 639 | 639 | @panic("unable to make tmp dir for testing: unable to make and open .zig-cache dir"); |
| 640 | 640 | 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 | |
| 642 | 642 | @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 | |
| 644 | 644 | @panic("unable to make tmp dir for testing: unable to make and open the tmp dir"); |
| 645 | 645 | |
| 646 | 646 | return .{ |
lib/std/zip.zig+2-2| ... | ... | @@ -554,13 +554,13 @@ pub const Iterator = struct { |
| 554 | 554 | if (filename[filename.len - 1] == '/') { |
| 555 | 555 | if (self.uncompressed_size != 0) |
| 556 | 556 | return error.ZipBadDirectorySize; |
| 557 | try dest.makePath(io, filename[0 .. filename.len - 1]); | |
| 557 | try dest.createDirPath(io, filename[0 .. filename.len - 1]); | |
| 558 | 558 | return; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | const out_file = blk: { |
| 562 | 562 | 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, .{}); | |
| 564 | 564 | defer parent_dir.close(io); |
| 565 | 565 | |
| 566 | 566 | const basename = std.fs.path.basename(filename); |
src/Compilation.zig+17-17| ... | ... | @@ -832,7 +832,7 @@ pub const Directories = struct { |
| 832 | 832 | const nonempty_path = if (path.len == 0) "." else path; |
| 833 | 833 | const handle_or_err = switch (thing) { |
| 834 | 834 | .@"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, .{}), | |
| 836 | 836 | }; |
| 837 | 837 | return .{ |
| 838 | 838 | .path = if (path.len == 0) null else path, |
| ... | ... | @@ -1879,7 +1879,7 @@ pub const CreateDiagnostic = union(enum) { |
| 1879 | 1879 | pub const CreateCachePath = struct { |
| 1880 | 1880 | which: enum { local, global }, |
| 1881 | 1881 | 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), | |
| 1883 | 1883 | }; |
| 1884 | 1884 | pub fn format(diag: CreateDiagnostic, w: *Writer) Writer.Error!void { |
| 1885 | 1885 | switch (diag) { |
| ... | ... | @@ -2120,7 +2120,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2120 | 2120 | cache.* = .{ |
| 2121 | 2121 | .gpa = gpa, |
| 2122 | 2122 | .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| { | |
| 2124 | 2124 | return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = "h", .err = err } }); |
| 2125 | 2125 | }, |
| 2126 | 2126 | }; |
| ... | ... | @@ -2170,7 +2170,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2170 | 2170 | // to redundantly happen for each AstGen operation. |
| 2171 | 2171 | const zir_sub_dir = "z"; |
| 2172 | 2172 | |
| 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| { | |
| 2174 | 2174 | return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = zir_sub_dir, .err = err } }); |
| 2175 | 2175 | }; |
| 2176 | 2176 | errdefer local_zir_dir.close(io); |
| ... | ... | @@ -2178,7 +2178,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2178 | 2178 | .handle = local_zir_dir, |
| 2179 | 2179 | .path = try options.dirs.local_cache.join(arena, &.{zir_sub_dir}), |
| 2180 | 2180 | }; |
| 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| { | |
| 2182 | 2182 | return diag.fail(.{ .create_cache_path = .{ .which = .global, .sub = zir_sub_dir, .err = err } }); |
| 2183 | 2183 | }; |
| 2184 | 2184 | errdefer global_zir_dir.close(io); |
| ... | ... | @@ -2449,7 +2449,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2449 | 2449 | const digest = hash.final(); |
| 2450 | 2450 | |
| 2451 | 2451 | 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| { | |
| 2453 | 2453 | return diag.fail(.{ .create_cache_path = .{ .which = .local, .sub = artifact_sub_dir, .err = err } }); |
| 2454 | 2454 | }; |
| 2455 | 2455 | errdefer artifact_dir.close(io); |
| ... | ... | @@ -2917,7 +2917,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 2917 | 2917 | tmp_dir_rand_int = std.crypto.random.int(u64); |
| 2918 | 2918 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int); |
| 2919 | 2919 | 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| { | |
| 2921 | 2921 | return comp.setMiscFailure(.open_output, "failed to create output directory '{s}': {t}", .{ path, err }); |
| 2922 | 2922 | }; |
| 2923 | 2923 | break :d .{ .path = path, .handle = handle }; |
| ... | ... | @@ -2998,7 +2998,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) UpdateE |
| 2998 | 2998 | tmp_dir_rand_int = std.crypto.random.int(u64); |
| 2999 | 2999 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int); |
| 3000 | 3000 | 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| { | |
| 3002 | 3002 | return comp.setMiscFailure(.open_output, "failed to create output directory '{s}': {t}", .{ path, err }); |
| 3003 | 3003 | }; |
| 3004 | 3004 | break :d .{ .path = path, .handle = handle }; |
| ... | ... | @@ -3437,7 +3437,7 @@ fn renameTmpIntoCache( |
| 3437 | 3437 | continue; |
| 3438 | 3438 | }, |
| 3439 | 3439 | error.FileNotFound => { |
| 3440 | try cache_directory.handle.makePath(io, "o"); | |
| 3440 | try cache_directory.handle.createDirPath(io, "o"); | |
| 3441 | 3441 | continue; |
| 3442 | 3442 | }, |
| 3443 | 3443 | else => |e| return e, |
| ... | ... | @@ -5276,7 +5276,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { |
| 5276 | 5276 | const io = comp.io; |
| 5277 | 5277 | |
| 5278 | 5278 | 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| { | |
| 5280 | 5280 | return comp.lockAndSetMiscFailure( |
| 5281 | 5281 | .docs_copy, |
| 5282 | 5282 | "unable to create output directory '{f}': {s}", |
| ... | ... | @@ -5513,7 +5513,7 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU |
| 5513 | 5513 | assert(docs_bin_file.sub_path.len > 0); // emitted binary is not a directory |
| 5514 | 5514 | |
| 5515 | 5515 | 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| { | |
| 5517 | 5517 | comp.lockAndSetMiscFailure( |
| 5518 | 5518 | .docs_copy, |
| 5519 | 5519 | "unable to create output directory '{f}': {t}", |
| ... | ... | @@ -5705,7 +5705,7 @@ pub fn translateC( |
| 5705 | 5705 | const tmp_basename = std.fmt.hex(std.crypto.random.int(u64)); |
| 5706 | 5706 | const tmp_sub_path = "tmp" ++ fs.path.sep_str ++ tmp_basename; |
| 5707 | 5707 | 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, .{}); | |
| 5709 | 5709 | defer cache_tmp_dir.close(io); |
| 5710 | 5710 | |
| 5711 | 5711 | 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 |
| 6280 | 6280 | // We can't know the digest until we do the C compiler invocation, |
| 6281 | 6281 | // so we need a temporary filename. |
| 6282 | 6282 | 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", .{}); | |
| 6284 | 6284 | defer zig_cache_tmp_dir.close(io); |
| 6285 | 6285 | |
| 6286 | 6286 | 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 |
| 6445 | 6445 | // Rename into place. |
| 6446 | 6446 | const digest = man.final(); |
| 6447 | 6447 | 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, .{}); | |
| 6449 | 6449 | defer o_dir.close(io); |
| 6450 | 6450 | const tmp_basename = fs.path.basename(out_obj_path); |
| 6451 | 6451 | 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 |
| 6534 | 6534 | const digest = man.final(); |
| 6535 | 6535 | |
| 6536 | 6536 | 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, .{}); | |
| 6538 | 6538 | defer o_dir.close(io); |
| 6539 | 6539 | |
| 6540 | 6540 | const in_rc_path = try comp.dirs.local_cache.join(comp.gpa, &.{ |
| ... | ... | @@ -6622,7 +6622,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32 |
| 6622 | 6622 | const rc_basename_noext = src_basename[0 .. src_basename.len - fs.path.extension(src_basename).len]; |
| 6623 | 6623 | |
| 6624 | 6624 | 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", .{}); | |
| 6626 | 6626 | defer zig_cache_tmp_dir.close(io); |
| 6627 | 6627 | |
| 6628 | 6628 | 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 |
| 6693 | 6693 | // Rename into place. |
| 6694 | 6694 | const digest = man.final(); |
| 6695 | 6695 | 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, .{}); | |
| 6697 | 6697 | defer o_dir.close(io); |
| 6698 | 6698 | const tmp_basename = fs.path.basename(out_res_path); |
| 6699 | 6699 | 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( |
| 500 | 500 | var tmp_directory: Cache.Directory = .{ |
| 501 | 501 | .path = tmp_directory_path, |
| 502 | 502 | .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, .{ | |
| 504 | 504 | .open_options = .{ .iterate = true }, |
| 505 | 505 | }) catch |err| { |
| 506 | 506 | try eb.addRootErrorMessage(.{ |
| ... | ... | @@ -524,7 +524,7 @@ fn runResource( |
| 524 | 524 | if (native_os == .linux and f.job_queue.work_around_btrfs_bug) { |
| 525 | 525 | // https://github.com/ziglang/zig/issues/17095 |
| 526 | 526 | 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, .{ | |
| 528 | 528 | .open_options = .{ .iterate = true }, |
| 529 | 529 | }) catch @panic("btrfs workaround failed"); |
| 530 | 530 | } |
| ... | ... | @@ -1366,7 +1366,7 @@ fn unpackGitPack(f: *Fetch, out_dir: Io.Dir, resource: *Resource.Git) anyerror!U |
| 1366 | 1366 | // we do not attempt to replicate the exact structure of a real .git |
| 1367 | 1367 | // directory, since that isn't relevant for fetching a package. |
| 1368 | 1368 | { |
| 1369 | var pack_dir = try out_dir.makeOpenPath(io, ".git", .{}); | |
| 1369 | var pack_dir = try out_dir.createDirPathOpen(io, ".git", .{}); | |
| 1370 | 1370 | defer pack_dir.close(io); |
| 1371 | 1371 | var pack_file = try pack_dir.createFile(io, "pkg.pack", .{ .read = true }); |
| 1372 | 1372 | defer pack_file.close(io); |
| ... | ... | @@ -1427,7 +1427,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: Io.Dir, tmp_dir: Io.Dir) anyerror!void |
| 1427 | 1427 | .file => { |
| 1428 | 1428 | dir.copyFile(entry.path, tmp_dir, entry.path, io, .{}) catch |err| switch (err) { |
| 1429 | 1429 | 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); | |
| 1431 | 1431 | try dir.copyFile(entry.path, tmp_dir, entry.path, io, .{}); |
| 1432 | 1432 | }, |
| 1433 | 1433 | else => |e| return e, |
| ... | ... | @@ -1440,7 +1440,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: Io.Dir, tmp_dir: Io.Dir) anyerror!void |
| 1440 | 1440 | // the destination directory, fail with an error instead. |
| 1441 | 1441 | tmp_dir.symLink(io, link_name, entry.path, .{}) catch |err| switch (err) { |
| 1442 | 1442 | 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); | |
| 1444 | 1444 | try tmp_dir.symLink(io, link_name, entry.path, .{}); |
| 1445 | 1445 | }, |
| 1446 | 1446 | else => |e| return e, |
| ... | ... | @@ -2250,7 +2250,7 @@ const TestFetchBuilder = struct { |
| 2250 | 2250 | cache_parent_dir: std.Io.Dir, |
| 2251 | 2251 | path_or_url: []const u8, |
| 2252 | 2252 | ) !*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", .{}); | |
| 2254 | 2254 | |
| 2255 | 2255 | self.http_client = .{ .allocator = allocator, .io = io }; |
| 2256 | 2256 | self.global_cache_directory = .{ .handle = cache_dir, .path = null }; |
src/Package/Fetch/git.zig+2-2| ... | ... | @@ -1720,10 +1720,10 @@ pub fn main() !void { |
| 1720 | 1720 | var pack_file_reader = pack_file.reader(io, &pack_file_buffer); |
| 1721 | 1721 | |
| 1722 | 1722 | 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], .{}); | |
| 1724 | 1724 | defer worktree.close(io); |
| 1725 | 1725 | |
| 1726 | var git_dir = try worktree.makeOpenPath(io, ".git", .{}); | |
| 1726 | var git_dir = try worktree.createDirPathOpen(io, ".git", .{}); | |
| 1727 | 1727 | defer git_dir.close(io); |
| 1728 | 1728 | |
| 1729 | 1729 | 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 |
| 444 | 444 | var cache: Cache = .{ |
| 445 | 445 | .gpa = gpa, |
| 446 | 446 | .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", .{}), | |
| 448 | 448 | }; |
| 449 | 449 | cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() }); |
| 450 | 450 | cache.addPrefix(comp.dirs.zig_lib); |
| ... | ... | @@ -477,7 +477,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 477 | 477 | const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest }); |
| 478 | 478 | |
| 479 | 479 | 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, .{}), | |
| 481 | 481 | .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}), |
| 482 | 482 | }; |
| 483 | 483 | 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 |
| 679 | 679 | var cache: Cache = .{ |
| 680 | 680 | .gpa = gpa, |
| 681 | 681 | .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", .{}), | |
| 683 | 683 | }; |
| 684 | 684 | cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() }); |
| 685 | 685 | cache.addPrefix(comp.dirs.zig_lib); |
| ... | ... | @@ -712,7 +712,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 712 | 712 | const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest }); |
| 713 | 713 | |
| 714 | 714 | 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, .{}), | |
| 716 | 716 | .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}), |
| 717 | 717 | }; |
| 718 | 718 | 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 { |
| 258 | 258 | var cache: Cache = .{ |
| 259 | 259 | .gpa = gpa, |
| 260 | 260 | .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", .{}), | |
| 262 | 262 | }; |
| 263 | 263 | cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() }); |
| 264 | 264 | cache.addPrefix(comp.dirs.zig_lib); |
| ... | ... | @@ -297,7 +297,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { |
| 297 | 297 | |
| 298 | 298 | const digest = man.final(); |
| 299 | 299 | 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, .{}); | |
| 301 | 301 | defer o_dir.close(io); |
| 302 | 302 | |
| 303 | 303 | 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 |
| 385 | 385 | var cache: Cache = .{ |
| 386 | 386 | .gpa = gpa, |
| 387 | 387 | .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", .{}), | |
| 389 | 389 | }; |
| 390 | 390 | cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() }); |
| 391 | 391 | cache.addPrefix(comp.dirs.zig_lib); |
| ... | ... | @@ -418,7 +418,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 418 | 418 | const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest }); |
| 419 | 419 | |
| 420 | 420 | 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, .{}), | |
| 422 | 422 | .path = try comp.dirs.global_cache.join(arena, &.{o_sub_path}), |
| 423 | 423 | }; |
| 424 | 424 | defer o_directory.handle.close(io); |
src/link/MachO.zig+1-1| ... | ... | @@ -3319,7 +3319,7 @@ pub fn reopenDebugInfo(self: *MachO) !void { |
| 3319 | 3319 | ); |
| 3320 | 3320 | defer gpa.free(d_sym_path); |
| 3321 | 3321 | |
| 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, .{}); | |
| 3323 | 3323 | defer d_sym_bundle.close(io); |
| 3324 | 3324 | |
| 3325 | 3325 | 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( |
| 3381 | 3381 | const dump_path = try std.fmt.allocPrint(arena, "tmp" ++ sep ++ "{x}-dump-stdin{s}", .{ |
| 3382 | 3382 | std.crypto.random.int(u64), ext.canonicalName(target), |
| 3383 | 3383 | }); |
| 3384 | try dirs.local_cache.handle.makePath(io, "tmp"); | |
| 3384 | try dirs.local_cache.handle.createDirPath(io, "tmp"); | |
| 3385 | 3385 | |
| 3386 | 3386 | // Note that in one of the happy paths, execve() is used to switch to |
| 3387 | 3387 | // clang in which case any cleanup logic that exists for this temporary |
| ... | ... | @@ -6955,7 +6955,7 @@ fn cmdFetch( |
| 6955 | 6955 | var global_cache_directory: Directory = l: { |
| 6956 | 6956 | const p = override_global_cache_dir orelse try introspect.resolveGlobalCacheDir(arena); |
| 6957 | 6957 | break :l .{ |
| 6958 | .handle = try Io.Dir.cwd().makeOpenPath(io, p, .{}), | |
| 6958 | .handle = try Io.Dir.cwd().createDirPathOpen(io, p, .{}), | |
| 6959 | 6959 | .path = p, |
| 6960 | 6960 | }; |
| 6961 | 6961 | }; |
| ... | ... | @@ -7201,7 +7201,7 @@ fn createDependenciesModule( |
| 7201 | 7201 | const rand_int = std.crypto.random.int(u64); |
| 7202 | 7202 | const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int); |
| 7203 | 7203 | { |
| 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, .{}); | |
| 7205 | 7205 | defer tmp_dir.close(io); |
| 7206 | 7206 | try tmp_dir.writeFile(io, .{ .sub_path = basename, .data = source }); |
| 7207 | 7207 | } |
| ... | ... | @@ -7396,7 +7396,7 @@ const Templates = struct { |
| 7396 | 7396 | fingerprint: Package.Fingerprint, |
| 7397 | 7397 | ) !void { |
| 7398 | 7398 | if (fs.path.dirname(template_path)) |dirname| { |
| 7399 | out_dir.makePath(io, dirname) catch |err| { | |
| 7399 | out_dir.createDirPath(io, dirname) catch |err| { | |
| 7400 | 7400 | fatal("unable to make path '{s}': {t}", .{ dirname, err }); |
| 7401 | 7401 | }; |
| 7402 | 7402 | } |