authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-06 17:32:19-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:08-08:00
logdd1d15b72aa3bae4b38e2337609758ffb7a7b55a
treee6e43ed851e9a0107e851df242c23b66855151d3
parent3204fb756980c19b7a95534acdd7a1bba837fbc3

update all occurrences of std.fs.Dir to std.Io.Dir


24 files changed, 81 insertions(+), 78 deletions(-)

lib/compiler/aro/aro/Compilation.zig+3-3
......@@ -154,7 +154,7 @@ gpa: Allocator,
154154/// Allocations in this arena live all the way until `Compilation.deinit`.
155155arena: Allocator,
156156io: Io,
157cwd: std.fs.Dir,
157cwd: Io.Dir,
158158diagnostics: *Diagnostics,
159159
160160sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
......@@ -181,7 +181,7 @@ pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
181181/// Used by MS extensions which allow searching for includes relative to the directory of the main source file.
182182ms_cwd_source_id: ?Source.Id = null,
183183
184pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: std.fs.Dir) Compilation {
184pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: Io.Dir) Compilation {
185185 return .{
186186 .gpa = gpa,
187187 .arena = arena,
......@@ -193,7 +193,7 @@ pub fn init(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics,
193193
194194/// Initialize Compilation with default environment,
195195/// pragma handlers and emulation mode set to target.
196pub fn initDefault(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: std.fs.Dir) !Compilation {
196pub fn initDefault(gpa: Allocator, arena: Allocator, io: Io, diagnostics: *Diagnostics, cwd: Io.Dir) !Compilation {
197197 var comp: Compilation = .{
198198 .gpa = gpa,
199199 .arena = arena,
lib/compiler/resinator/cli.zig+1-1
......@@ -250,7 +250,7 @@ pub const Options = struct {
250250 /// worlds' situation where we'll be compatible with most use-cases
251251 /// of the .rc extension being omitted from the CLI args, but still
252252 /// work fine if the file itself does not have an extension.
253 pub fn maybeAppendRC(options: *Options, cwd: std.fs.Dir) !void {
253 pub fn maybeAppendRC(options: *Options, cwd: Io.Dir) !void {
254254 switch (options.input_source) {
255255 .stdio => return,
256256 .filename => {},
lib/compiler/resinator/errors.zig+3-3
......@@ -67,7 +67,7 @@ pub const Diagnostics = struct {
6767 return @intCast(index);
6868 }
6969
70 pub fn renderToStdErr(self: *Diagnostics, cwd: std.fs.Dir, source: []const u8, source_mappings: ?SourceMappings) void {
70 pub fn renderToStdErr(self: *Diagnostics, cwd: Io.Dir, source: []const u8, source_mappings: ?SourceMappings) void {
7171 const io = self.io;
7272 const stderr, const ttyconf = std.debug.lockStderrWriter(&.{});
7373 defer std.debug.unlockStderrWriter();
......@@ -903,7 +903,7 @@ pub fn renderErrorMessage(
903903 io: Io,
904904 writer: *std.Io.Writer,
905905 tty_config: std.Io.tty.Config,
906 cwd: std.fs.Dir,
906 cwd: Io.Dir,
907907 err_details: ErrorDetails,
908908 source: []const u8,
909909 strings: []const []const u8,
......@@ -1100,7 +1100,7 @@ const CorrespondingLines = struct {
11001100
11011101 pub fn init(
11021102 io: Io,
1103 cwd: std.fs.Dir,
1103 cwd: Io.Dir,
11041104 err_details: ErrorDetails,
11051105 line_for_comparison: []const u8,
11061106 corresponding_span: SourceMappings.CorrespondingSpan,
lib/compiler/resinator/main.zig+1-1
......@@ -707,7 +707,7 @@ const ErrorHandler = union(enum) {
707707 pub fn emitDiagnostics(
708708 self: *ErrorHandler,
709709 allocator: Allocator,
710 cwd: std.fs.Dir,
710 cwd: Io.Dir,
711711 source: []const u8,
712712 diagnostics: *Diagnostics,
713713 mappings: SourceMappings,
lib/compiler/resinator/utils.zig+2-2
......@@ -25,11 +25,11 @@ pub const UncheckedSliceWriter = struct {
2525 }
2626};
2727
28/// Cross-platform 'std.fs.Dir.openFile' wrapper that will always return IsDir if
28/// Cross-platform 'Io.Dir.openFile' wrapper that will always return IsDir if
2929/// a directory is attempted to be opened.
3030/// TODO: Remove once https://github.com/ziglang/zig/issues/5732 is addressed.
3131pub fn openFileNotDir(
32 cwd: std.fs.Dir,
32 cwd: Io.Dir,
3333 io: Io,
3434 path: []const u8,
3535 flags: Io.File.OpenFlags,
lib/compiler/std-docs.zig+1-1
......@@ -133,7 +133,7 @@ fn accept(context: *Context, connection: std.net.Server.Connection) void {
133133const Context = struct {
134134 gpa: Allocator,
135135 io: Io,
136 lib_dir: std.fs.Dir,
136 lib_dir: Io.Dir,
137137 zig_lib_directory: []const u8,
138138 zig_exe_path: []const u8,
139139 global_cache_path: []const u8,
lib/std/Build.zig+1-1
......@@ -1699,7 +1699,7 @@ pub fn addCheckFile(
16991699 return Step.CheckFile.create(b, file_source, options);
17001700}
17011701
1702pub fn truncateFile(b: *Build, dest_path: []const u8) (fs.Dir.MakeError || fs.Dir.StatFileError)!void {
1702pub fn truncateFile(b: *Build, dest_path: []const u8) (Io.Dir.MakeError || Io.Dir.StatFileError)!void {
17031703 const io = b.graph.io;
17041704 if (b.verbose) log.info("truncate {s}", .{dest_path});
17051705 const cwd = fs.cwd();
lib/std/Build/Step.zig+3-3
......@@ -505,7 +505,7 @@ pub fn evalZigProcess(
505505 return result;
506506}
507507
508/// Wrapper around `std.fs.Dir.updateFile` that handles verbose and error output.
508/// Wrapper around `Io.Dir.updateFile` that handles verbose and error output.
509509pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u8) !Io.Dir.PrevStatus {
510510 const b = s.owner;
511511 const io = b.graph.io;
......@@ -515,8 +515,8 @@ pub fn installFile(s: *Step, src_lazy_path: Build.LazyPath, dest_path: []const u
515515 return s.fail("unable to update file from '{f}' to '{s}': {t}", .{ src_path, dest_path, err });
516516}
517517
518/// Wrapper around `std.fs.Dir.makePathStatus` that handles verbose and error output.
519pub fn installDir(s: *Step, dest_path: []const u8) !std.fs.Dir.MakePathStatus {
518/// Wrapper around `Io.Dir.makePathStatus` that handles verbose and error output.
519pub fn installDir(s: *Step, dest_path: []const u8) !Io.Dir.MakePathStatus {
520520 const b = s.owner;
521521 try handleVerbose(b, null, &.{ "install", "-d", dest_path });
522522 return std.fs.cwd().makePathStatus(dest_path) catch |err|
lib/std/Build/Watch.zig+1-1
......@@ -350,7 +350,7 @@ const Os = switch (builtin.os.tag) {
350350 }
351351
352352 fn init(gpa: Allocator, path: Cache.Path) !*@This() {
353 // The following code is a drawn out NtCreateFile call. (mostly adapted from std.fs.Dir.makeOpenDirAccessMaskW)
353 // The following code is a drawn out NtCreateFile call. (mostly adapted from Io.Dir.makeOpenDirAccessMaskW)
354354 // It's necessary in order to get the specific flags that are required when calling ReadDirectoryChangesW.
355355 var dir_handle: windows.HANDLE = undefined;
356356 const root_fd = path.root_dir.handle.fd;
lib/std/Io/Dir.zig+1-1
......@@ -481,7 +481,7 @@ pub fn updateFile(
481481 }
482482
483483 var buffer: [1000]u8 = undefined; // Used only when direct fd-to-fd is not available.
484 var atomic_file = try std.fs.Dir.atomicFile(.adaptFromNewApi(dest_dir), dest_path, .{
484 var atomic_file = try Dir.atomicFile(.adaptFromNewApi(dest_dir), dest_path, .{
485485 .permissions = actual_permissions,
486486 .write_buffer = &buffer,
487487 });
lib/std/crypto/Certificate/Bundle.zig+2-2
......@@ -177,7 +177,7 @@ pub fn addCertsFromDirPath(
177177 cb: *Bundle,
178178 gpa: Allocator,
179179 io: Io,
180 dir: fs.Dir,
180 dir: Io.Dir,
181181 sub_dir_path: []const u8,
182182) AddCertsFromDirPathError!void {
183183 var iterable_dir = try dir.openDir(sub_dir_path, .{ .iterate = true });
......@@ -200,7 +200,7 @@ pub fn addCertsFromDirPathAbsolute(
200200
201201pub const AddCertsFromDirError = AddCertsFromFilePathError;
202202
203pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, io: Io, now: Io.Timestamp, iterable_dir: fs.Dir) AddCertsFromDirError!void {
203pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, io: Io, now: Io.Timestamp, iterable_dir: Io.Dir) AddCertsFromDirError!void {
204204 var it = iterable_dir.iterate();
205205 while (try it.next()) |entry| {
206206 switch (entry.kind) {
lib/std/dynamic_library.zig+1-1
......@@ -157,7 +157,7 @@ pub const ElfDynLib = struct {
157157 dt_gnu_hash: *elf.gnu_hash.Header,
158158 };
159159
160 fn openPath(path: []const u8, io: Io) !std.fs.Dir {
160 fn openPath(path: []const u8, io: Io) !Io.Dir {
161161 if (path.len == 0) return error.NotDir;
162162 var parts = std.mem.tokenizeScalar(u8, path, '/');
163163 var parent = if (path[0] == '/') try std.fs.cwd().openDir("/", .{}) else std.fs.cwd();
lib/std/fs/path.zig+2-2
......@@ -872,7 +872,7 @@ pub fn resolve(allocator: Allocator, paths: []const []const u8) Allocator.Error!
872872
873873/// This function is like a series of `cd` statements executed one after another.
874874/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to
875/// an absolute path, use std.fs.Dir.realpath instead.
875/// an absolute path, use Io.Dir.realpath instead.
876876/// ".." components may persist in the resolved path if the resolved path is relative or drive-relative.
877877/// Path separators are canonicalized to '\\' and drives are canonicalized to capital letters.
878878///
......@@ -1095,7 +1095,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) Allocator
10951095
10961096/// This function is like a series of `cd` statements executed one after another.
10971097/// It resolves "." and ".." to the best of its ability, but will not convert relative paths to
1098/// an absolute path, use std.fs.Dir.realpath instead.
1098/// an absolute path, use Io.Dir.realpath instead.
10991099/// ".." components may persist in the resolved path if the resolved path is relative.
11001100/// The result does not have a trailing path separator.
11011101/// This function does not perform any syscalls. Executing this series of path
lib/std/fs/test.zig+6-7
......@@ -9,12 +9,11 @@ const mem = std.mem;
99const wasi = std.os.wasi;
1010const windows = std.os.windows;
1111const posix = std.posix;
12
1312const ArenaAllocator = std.heap.ArenaAllocator;
14const Dir = std.fs.Dir;
13const Dir = std.Io.Dir;
1514const File = std.Io.File;
16const tmpDir = testing.tmpDir;
17const SymLinkFlags = std.fs.Dir.SymLinkFlags;
15const tmpDir = std.testing.tmpDir;
16const SymLinkFlags = std.Io.Dir.SymLinkFlags;
1817
1918const PathType = enum {
2019 relative,
......@@ -80,7 +79,7 @@ const TestContext = struct {
8079 path_sep: u8,
8180 arena: ArenaAllocator,
8281 tmp: testing.TmpDir,
83 dir: std.fs.Dir,
82 dir: Io.Dir,
8483 transform_fn: *const PathType.TransformFn,
8584
8685 pub fn init(path_type: PathType, path_sep: u8, allocator: mem.Allocator, transform_fn: *const PathType.TransformFn) TestContext {
......@@ -1772,7 +1771,7 @@ test "open file with exclusive lock twice, make sure second lock waits" {
17721771 errdefer file.close(io);
17731772
17741773 const S = struct {
1775 fn checkFn(dir: *fs.Dir, path: []const u8, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void {
1774 fn checkFn(dir: *Io.Dir, path: []const u8, started: *std.Thread.ResetEvent, locked: *std.Thread.ResetEvent) !void {
17761775 started.set();
17771776 const file1 = try dir.createFile(path, .{ .lock = .exclusive });
17781777
......@@ -2016,7 +2015,7 @@ test "walker without fully iterating" {
20162015 try testing.expectEqual(@as(usize, 1), num_walked);
20172016}
20182017
2019test "'.' and '..' in fs.Dir functions" {
2018test "'.' and '..' in Io.Dir functions" {
20202019 if (native_os == .windows and builtin.cpu.arch == .aarch64) {
20212020 // https://github.com/ziglang/zig/issues/17134
20222021 return error.SkipZigTest;
lib/std/process/Child.zig+2-2
......@@ -77,7 +77,7 @@ cwd: ?[]const u8,
7777/// Set to change the current working directory when spawning the child process.
7878/// This is not yet implemented for Windows. See https://github.com/ziglang/zig/issues/5190
7979/// Once that is done, `cwd` will be deprecated in favor of this field.
80cwd_dir: ?fs.Dir = null,
80cwd_dir: ?Io.Dir = null,
8181
8282err_pipe: if (native_os == .windows) void else ?posix.fd_t,
8383
......@@ -439,7 +439,7 @@ pub fn run(args: struct {
439439 allocator: mem.Allocator,
440440 argv: []const []const u8,
441441 cwd: ?[]const u8 = null,
442 cwd_dir: ?fs.Dir = null,
442 cwd_dir: ?Io.Dir = null,
443443 /// Required if unable to access the current env map (e.g. building a
444444 /// library on some platforms).
445445 env_map: ?*const EnvMap = null,
lib/std/testing.zig+31-29
......@@ -1,5 +1,7 @@
1const std = @import("std.zig");
21const builtin = @import("builtin");
2
3const std = @import("std.zig");
4const Io = std.Io;
35const assert = std.debug.assert;
46const math = std.math;
57
......@@ -28,7 +30,7 @@ pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{
2830 break :b .init;
2931};
3032
31pub var io_instance: std.Io.Threaded = undefined;
33pub var io_instance: Io.Threaded = undefined;
3234pub const io = io_instance.io();
3335
3436/// TODO https://github.com/ziglang/zig/issues/5738
......@@ -355,7 +357,7 @@ test expectApproxEqRel {
355357/// This function is intended to be used only in tests. When the two slices are not
356358/// equal, prints diagnostics to stderr to show exactly how they are not equal (with
357359/// the differences highlighted in red), then returns a test failure error.
358/// The colorized output is optional and controlled by the return of `std.Io.tty.Config.detect`.
360/// The colorized output is optional and controlled by the return of `Io.tty.Config.detect`.
359361/// If your inputs are UTF-8 encoded strings, consider calling `expectEqualStrings` instead.
360362pub fn expectEqualSlices(comptime T: type, expected: []const T, actual: []const T) !void {
361363 const diff_index: usize = diff_index: {
......@@ -378,8 +380,8 @@ fn failEqualSlices(
378380 expected: []const T,
379381 actual: []const T,
380382 diff_index: usize,
381 w: *std.Io.Writer,
382 ttyconf: std.Io.tty.Config,
383 w: *Io.Writer,
384 ttyconf: Io.tty.Config,
383385) !void {
384386 try w.print("slices differ. first difference occurs at index {d} (0x{X})\n", .{ diff_index, diff_index });
385387
......@@ -464,11 +466,11 @@ fn SliceDiffer(comptime T: type) type {
464466 start_index: usize,
465467 expected: []const T,
466468 actual: []const T,
467 ttyconf: std.Io.tty.Config,
469 ttyconf: Io.tty.Config,
468470
469471 const Self = @This();
470472
471 pub fn write(self: Self, writer: *std.Io.Writer) !void {
473 pub fn write(self: Self, writer: *Io.Writer) !void {
472474 for (self.expected, 0..) |value, i| {
473475 const full_index = self.start_index + i;
474476 const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
......@@ -487,9 +489,9 @@ fn SliceDiffer(comptime T: type) type {
487489const BytesDiffer = struct {
488490 expected: []const u8,
489491 actual: []const u8,
490 ttyconf: std.Io.tty.Config,
492 ttyconf: Io.tty.Config,
491493
492 pub fn write(self: BytesDiffer, writer: *std.Io.Writer) !void {
494 pub fn write(self: BytesDiffer, writer: *Io.Writer) !void {
493495 var expected_iterator = std.mem.window(u8, self.expected, 16, 16);
494496 var row: usize = 0;
495497 while (expected_iterator.next()) |chunk| {
......@@ -535,7 +537,7 @@ const BytesDiffer = struct {
535537 }
536538 }
537539
538 fn writeDiff(self: BytesDiffer, writer: *std.Io.Writer, comptime fmt: []const u8, args: anytype, diff: bool) !void {
540 fn writeDiff(self: BytesDiffer, writer: *Io.Writer, comptime fmt: []const u8, args: anytype, diff: bool) !void {
539541 if (diff) try self.ttyconf.setColor(writer, .red);
540542 try writer.print(fmt, args);
541543 if (diff) try self.ttyconf.setColor(writer, .reset);
......@@ -605,8 +607,8 @@ pub fn expect(ok: bool) !void {
605607}
606608
607609pub const TmpDir = struct {
608 dir: std.fs.Dir,
609 parent_dir: std.fs.Dir,
610 dir: Io.Dir,
611 parent_dir: Io.Dir,
610612 sub_path: [sub_path_len]u8,
611613
612614 const random_bytes_count = 12;
......@@ -620,7 +622,7 @@ pub const TmpDir = struct {
620622 }
621623};
622624
623pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir {
625pub fn tmpDir(opts: Io.Dir.OpenOptions) TmpDir {
624626 var random_bytes: [TmpDir.random_bytes_count]u8 = undefined;
625627 std.crypto.random.bytes(&random_bytes);
626628 var sub_path: [TmpDir.sub_path_len]u8 = undefined;
......@@ -929,7 +931,7 @@ test "expectEqualDeep primitive type" {
929931 a,
930932 b,
931933
932 pub fn format(self: @This(), writer: *std.Io.Writer) !void {
934 pub fn format(self: @This(), writer: *Io.Writer) !void {
933935 try writer.writeAll(@tagName(self));
934936 }
935937 };
......@@ -1160,7 +1162,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
11601162 } else |err| switch (err) {
11611163 error.OutOfMemory => {
11621164 if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) {
1163 const tty_config: std.Io.tty.Config = .detect(.stderr());
1165 const tty_config: Io.tty.Config = .detect(.stderr());
11641166 print(
11651167 "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}",
11661168 .{
......@@ -1220,14 +1222,14 @@ pub inline fn fuzz(
12201222 return @import("root").fuzz(context, testOne, options);
12211223}
12221224
1223/// A `std.Io.Reader` that writes a predetermined list of buffers during `stream`.
1225/// A `Io.Reader` that writes a predetermined list of buffers during `stream`.
12241226pub const Reader = struct {
12251227 calls: []const Call,
1226 interface: std.Io.Reader,
1228 interface: Io.Reader,
12271229 next_call_index: usize,
12281230 next_offset: usize,
12291231 /// Further reduces how many bytes are written in each `stream` call.
1230 artificial_limit: std.Io.Limit = .unlimited,
1232 artificial_limit: Io.Limit = .unlimited,
12311233
12321234 pub const Call = struct {
12331235 buffer: []const u8,
......@@ -1247,7 +1249,7 @@ pub const Reader = struct {
12471249 };
12481250 }
12491251
1250 fn stream(io_r: *std.Io.Reader, w: *std.Io.Writer, limit: std.Io.Limit) std.Io.Reader.StreamError!usize {
1252 fn stream(io_r: *Io.Reader, w: *Io.Writer, limit: Io.Limit) Io.Reader.StreamError!usize {
12511253 const r: *Reader = @alignCast(@fieldParentPtr("interface", io_r));
12521254 if (r.calls.len - r.next_call_index == 0) return error.EndOfStream;
12531255 const call = r.calls[r.next_call_index];
......@@ -1262,13 +1264,13 @@ pub const Reader = struct {
12621264 }
12631265};
12641266
1265/// A `std.Io.Reader` that gets its data from another `std.Io.Reader`, and always
1267/// A `Io.Reader` that gets its data from another `Io.Reader`, and always
12661268/// writes to its own buffer (and returns 0) during `stream` and `readVec`.
12671269pub const ReaderIndirect = struct {
1268 in: *std.Io.Reader,
1269 interface: std.Io.Reader,
1270 in: *Io.Reader,
1271 interface: Io.Reader,
12701272
1271 pub fn init(in: *std.Io.Reader, buffer: []u8) ReaderIndirect {
1273 pub fn init(in: *Io.Reader, buffer: []u8) ReaderIndirect {
12721274 return .{
12731275 .in = in,
12741276 .interface = .{
......@@ -1283,17 +1285,17 @@ pub const ReaderIndirect = struct {
12831285 };
12841286 }
12851287
1286 fn readVec(r: *std.Io.Reader, _: [][]u8) std.Io.Reader.Error!usize {
1288 fn readVec(r: *Io.Reader, _: [][]u8) Io.Reader.Error!usize {
12871289 try streamInner(r);
12881290 return 0;
12891291 }
12901292
1291 fn stream(r: *std.Io.Reader, _: *std.Io.Writer, _: std.Io.Limit) std.Io.Reader.StreamError!usize {
1293 fn stream(r: *Io.Reader, _: *Io.Writer, _: Io.Limit) Io.Reader.StreamError!usize {
12921294 try streamInner(r);
12931295 return 0;
12941296 }
12951297
1296 fn streamInner(r: *std.Io.Reader) std.Io.Reader.Error!void {
1298 fn streamInner(r: *Io.Reader) Io.Reader.Error!void {
12971299 const r_indirect: *ReaderIndirect = @alignCast(@fieldParentPtr("interface", r));
12981300
12991301 // If there's no room remaining in the buffer at all, make room.
......@@ -1301,12 +1303,12 @@ pub const ReaderIndirect = struct {
13011303 try r.rebase(r.buffer.len);
13021304 }
13031305
1304 var writer: std.Io.Writer = .{
1306 var writer: Io.Writer = .{
13051307 .buffer = r.buffer,
13061308 .end = r.end,
13071309 .vtable = &.{
1308 .drain = std.Io.Writer.unreachableDrain,
1309 .rebase = std.Io.Writer.unreachableRebase,
1310 .drain = Io.Writer.unreachableDrain,
1311 .rebase = Io.Writer.unreachableRebase,
13101312 },
13111313 };
13121314 defer r.end = writer.end;
lib/std/zig/WindowsSdk.zig+4-4
......@@ -77,7 +77,7 @@ pub fn free(sdk: WindowsSdk, allocator: Allocator) void {
7777/// and a version. Returns slice of version strings sorted in descending order.
7878/// Caller owns result.
7979fn iterateAndFilterByVersion(
80 iterator: *std.fs.Dir.Iterator,
80 iterator: *Io.Dir.Iterator,
8181 allocator: Allocator,
8282 prefix: []const u8,
8383) error{OutOfMemory}![][]const u8 {
......@@ -608,7 +608,7 @@ pub const Installation = struct {
608608};
609609
610610const MsvcLibDir = struct {
611 fn findInstancesDirViaSetup(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {
611 fn findInstancesDirViaSetup(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
612612 const vs_setup_key_path = "SOFTWARE\\Microsoft\\VisualStudio\\Setup";
613613 const vs_setup_key = RegistryWtf8.openKey(windows.HKEY_LOCAL_MACHINE, vs_setup_key_path, .{}) catch |err| switch (err) {
614614 error.KeyNotFound => return error.PathNotFound,
......@@ -633,7 +633,7 @@ const MsvcLibDir = struct {
633633 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;
634634 }
635635
636 fn findInstancesDirViaCLSID(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {
636 fn findInstancesDirViaCLSID(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
637637 const setup_configuration_clsid = "{177f0c4a-1cd3-4de7-a32c-71dbbb9fa36d}";
638638 const setup_config_key = RegistryWtf8.openKey(windows.HKEY_CLASSES_ROOT, "CLSID\\" ++ setup_configuration_clsid, .{}) catch |err| switch (err) {
639639 error.KeyNotFound => return error.PathNotFound,
......@@ -669,7 +669,7 @@ const MsvcLibDir = struct {
669669 return std.fs.openDirAbsolute(instances_path, .{ .iterate = true }) catch return error.PathNotFound;
670670 }
671671
672 fn findInstancesDir(allocator: Allocator) error{ OutOfMemory, PathNotFound }!std.fs.Dir {
672 fn findInstancesDir(allocator: Allocator) error{ OutOfMemory, PathNotFound }!Io.Dir {
673673 // First, try getting the packages cache path from the registry.
674674 // This only seems to exist when the path is different from the default.
675675 method1: {
lib/std/zig/llvm/Builder.zig+1-1
......@@ -9582,7 +9582,7 @@ pub fn dump(b: *Builder) void {
95829582 b.printToFile(stderr, &buffer) catch {};
95839583}
95849584
9585pub fn printToFilePath(b: *Builder, io: Io, dir: std.fs.Dir, path: []const u8) !void {
9585pub fn printToFilePath(b: *Builder, io: Io, dir: Io.Dir, path: []const u8) !void {
95869586 var buffer: [4000]u8 = undefined;
95879587 const file = try dir.createFile(io, path, .{});
95889588 defer file.close(io);
lib/std/zip.zig+3-2
......@@ -7,6 +7,7 @@ const builtin = @import("builtin");
77const is_le = builtin.target.cpu.arch.endian() == .little;
88
99const std = @import("std");
10const Io = std.Io;
1011const File = std.Io.File;
1112const Writer = std.Io.Writer;
1213const Reader = std.Io.Reader;
......@@ -461,7 +462,7 @@ pub const Iterator = struct {
461462 stream: *File.Reader,
462463 options: ExtractOptions,
463464 filename_buf: []u8,
464 dest: std.fs.Dir,
465 dest: Io.Dir,
465466 ) !void {
466467 if (filename_buf.len < self.filename_len)
467468 return error.ZipInsufficientBuffer;
......@@ -650,7 +651,7 @@ pub const ExtractOptions = struct {
650651};
651652
652653/// Extract the zipped files to the given `dest` directory.
653pub fn extract(dest: std.fs.Dir, fr: *File.Reader, options: ExtractOptions) !void {
654pub fn extract(dest: Io.Dir, fr: *File.Reader, options: ExtractOptions) !void {
654655 if (options.verify_checksums) @panic("TODO unimplemented");
655656
656657 var iter = try Iterator.init(fr);
src/Compilation.zig+2-2
......@@ -446,7 +446,7 @@ pub const Path = struct {
446446 }
447447
448448 /// Given a `Path`, returns the directory handle and sub path to be used to open the path.
449 pub fn openInfo(p: Path, dirs: Directories) struct { fs.Dir, []const u8 } {
449 pub fn openInfo(p: Path, dirs: Directories) struct { Io.Dir, []const u8 } {
450450 const dir = switch (p.root) {
451451 .none => {
452452 const cwd_sub_path = absToCwdRelative(p.sub_path, dirs.cwd);
......@@ -1872,7 +1872,7 @@ pub const CreateDiagnostic = union(enum) {
18721872 pub const CreateCachePath = struct {
18731873 which: enum { local, global },
18741874 sub: []const u8,
1875 err: (fs.Dir.MakeError || fs.Dir.OpenError || fs.Dir.StatFileError),
1875 err: (Io.Dir.MakeError || Io.Dir.OpenError || Io.Dir.StatFileError),
18761876 };
18771877 pub fn format(diag: CreateDiagnostic, w: *Writer) Writer.Error!void {
18781878 switch (diag) {
src/Package/Fetch/git.zig+2-2
......@@ -214,7 +214,7 @@ pub const Repository = struct {
214214 pub fn checkout(
215215 repository: *Repository,
216216 io: Io,
217 worktree: std.fs.Dir,
217 worktree: Io.Dir,
218218 commit_oid: Oid,
219219 diagnostics: *Diagnostics,
220220 ) !void {
......@@ -231,7 +231,7 @@ pub const Repository = struct {
231231 fn checkoutTree(
232232 repository: *Repository,
233233 io: Io,
234 dir: std.fs.Dir,
234 dir: Io.Dir,
235235 tree_oid: Oid,
236236 current_path: []const u8,
237237 diagnostics: *Diagnostics,
src/fmt.zig+3-3
......@@ -204,7 +204,7 @@ pub fn run(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8) !
204204 }
205205}
206206
207fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) !void {
207fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: Io.Dir, sub_path: []const u8) !void {
208208 fmtPathFile(fmt, file_path, check_mode, dir, sub_path) catch |err| switch (err) {
209209 error.IsDir, error.AccessDenied => return fmtPathDir(fmt, file_path, check_mode, dir, sub_path),
210210 else => {
......@@ -219,7 +219,7 @@ fn fmtPathDir(
219219 fmt: *Fmt,
220220 file_path: []const u8,
221221 check_mode: bool,
222 parent_dir: fs.Dir,
222 parent_dir: Io.Dir,
223223 parent_sub_path: []const u8,
224224) !void {
225225 const io = fmt.io;
......@@ -257,7 +257,7 @@ fn fmtPathFile(
257257 fmt: *Fmt,
258258 file_path: []const u8,
259259 check_mode: bool,
260 dir: fs.Dir,
260 dir: Io.Dir,
261261 sub_path: []const u8,
262262) !void {
263263 const io = fmt.io;
src/link/Lld.zig+4-3
......@@ -400,7 +400,7 @@ fn coffLink(lld: *Lld, arena: Allocator) !void {
400400 // regarding eliding redundant object -> object transformations.
401401 return error.NoObjectsToLink;
402402 };
403 try std.fs.Dir.copyFile(
403 try Io.Dir.copyFile(
404404 the_object_path.root_dir.handle,
405405 the_object_path.sub_path,
406406 directory.handle,
......@@ -816,7 +816,7 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
816816 // regarding eliding redundant object -> object transformations.
817817 return error.NoObjectsToLink;
818818 };
819 try std.fs.Dir.copyFile(
819 try Io.Dir.copyFile(
820820 the_object_path.root_dir.handle,
821821 the_object_path.sub_path,
822822 directory.handle,
......@@ -1371,7 +1371,7 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void {
13711371 // regarding eliding redundant object -> object transformations.
13721372 return error.NoObjectsToLink;
13731373 };
1374 try fs.Dir.copyFile(
1374 try Io.Dir.copyFile(
13751375 the_object_path.root_dir.handle,
13761376 the_object_path.sub_path,
13771377 directory.handle,
......@@ -1692,6 +1692,7 @@ fn spawnLld(comp: *Compilation, arena: Allocator, argv: []const []const u8) !voi
16921692}
16931693
16941694const std = @import("std");
1695const Io = std.Io;
16951696const Allocator = std.mem.Allocator;
16961697const Cache = std.Build.Cache;
16971698const allocPrint = std.fmt.allocPrint;
src/link/MachO.zig+1-1
......@@ -3573,7 +3573,7 @@ pub fn getTarget(self: *const MachO) *const std.Target {
35733573/// into a new inode, remove the original file, and rename the copy to match
35743574/// the original file. This is super messy, but there doesn't seem any other
35753575/// way to please the XNU.
3576pub fn invalidateKernelCache(dir: fs.Dir, sub_path: []const u8) !void {
3576pub fn invalidateKernelCache(dir: Io.Dir, sub_path: []const u8) !void {
35773577 const tracy = trace(@src());
35783578 defer tracy.end();
35793579 if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) {