authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 23:06:42+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-25 20:17:07+01:00
log4159add4abe92e903d8797a005344d8325def2fc
treea18989d582306738a92706b1d5cfc846d229ad11
parente96de1b63688d3a92932fe4afdfe37dbe2315f53

std.fs.file: Rename File.Kind enum values to snake case


12 files changed, 153 insertions(+), 153 deletions(-)

lib/std/Build/Step/InstallDir.zig+2-2
......@@ -80,8 +80,8 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
8080 const cwd = fs.cwd();
8181
8282 switch (entry.kind) {
83 .Directory => try cwd.makePath(dest_path),
84 .File => {
83 .directory => try cwd.makePath(dest_path),
84 .file => {
8585 for (self.options.blank_extensions) |ext| {
8686 if (mem.endsWith(u8, entry.path, ext)) {
8787 try dest_builder.truncateFile(dest_path);
lib/std/crypto/Certificate/Bundle.zig+1-1
......@@ -169,7 +169,7 @@ pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.IterableDir
169169 var it = iterable_dir.iterate();
170170 while (try it.next()) |entry| {
171171 switch (entry.kind) {
172 .File, .SymLink => {},
172 .file, .sym_link => {},
173173 else => continue,
174174 }
175175
lib/std/fs.zig+66-66
......@@ -385,16 +385,16 @@ pub const IterableDir = struct {
385385 continue :start_over;
386386 }
387387
388 const entry_kind = switch (darwin_entry.d_type) {
389 os.DT.BLK => Entry.Kind.BlockDevice,
390 os.DT.CHR => Entry.Kind.CharacterDevice,
391 os.DT.DIR => Entry.Kind.Directory,
392 os.DT.FIFO => Entry.Kind.NamedPipe,
393 os.DT.LNK => Entry.Kind.SymLink,
394 os.DT.REG => Entry.Kind.File,
395 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
396 os.DT.WHT => Entry.Kind.Whiteout,
397 else => Entry.Kind.Unknown,
388 const entry_kind: Entry.Kind = switch (darwin_entry.d_type) {
389 os.DT.BLK => .block_device,
390 os.DT.CHR => .character_device,
391 os.DT.DIR => .directory,
392 os.DT.FIFO => .named_pipe,
393 os.DT.LNK => .sym_link,
394 os.DT.REG => .file,
395 os.DT.SOCK => .unix_domain_socket,
396 os.DT.WHT => .whiteout,
397 else => .unknown,
398398 };
399399 return Entry{
400400 .name = name,
......@@ -442,17 +442,17 @@ pub const IterableDir = struct {
442442 error.FileNotFound => unreachable, // lost the race
443443 else => |e| return e,
444444 };
445 const entry_kind = switch (stat_info.mode & os.S.IFMT) {
446 os.S.IFIFO => Entry.Kind.NamedPipe,
447 os.S.IFCHR => Entry.Kind.CharacterDevice,
448 os.S.IFDIR => Entry.Kind.Directory,
449 os.S.IFBLK => Entry.Kind.BlockDevice,
450 os.S.IFREG => Entry.Kind.File,
451 os.S.IFLNK => Entry.Kind.SymLink,
452 os.S.IFSOCK => Entry.Kind.UnixDomainSocket,
453 os.S.IFDOOR => Entry.Kind.Door,
454 os.S.IFPORT => Entry.Kind.EventPort,
455 else => Entry.Kind.Unknown,
445 const entry_kind: Entry.Kind = switch (stat_info.mode & os.S.IFMT) {
446 os.S.IFIFO => .named_pipe,
447 os.S.IFCHR => .character_device,
448 os.S.IFDIR => .directory,
449 os.S.IFBLK => .block_device,
450 os.S.IFREG => .file,
451 os.S.IFLNK => .sym_link,
452 os.S.IFSOCK => .unix_domain_socket,
453 os.S.IFDOOR => .door,
454 os.S.IFPORT => .event_port,
455 else => .unknown,
456456 };
457457 return Entry{
458458 .name = name,
......@@ -501,16 +501,16 @@ pub const IterableDir = struct {
501501 continue :start_over;
502502 }
503503
504 const entry_kind = switch (bsd_entry.d_type) {
505 os.DT.BLK => Entry.Kind.BlockDevice,
506 os.DT.CHR => Entry.Kind.CharacterDevice,
507 os.DT.DIR => Entry.Kind.Directory,
508 os.DT.FIFO => Entry.Kind.NamedPipe,
509 os.DT.LNK => Entry.Kind.SymLink,
510 os.DT.REG => Entry.Kind.File,
511 os.DT.SOCK => Entry.Kind.UnixDomainSocket,
512 os.DT.WHT => Entry.Kind.Whiteout,
513 else => Entry.Kind.Unknown,
504 const entry_kind: Entry.Kind = switch (bsd_entry.d_type) {
505 os.DT.BLK => .block_device,
506 os.DT.CHR => .character_device,
507 os.DT.DIR => .directory,
508 os.DT.FIFO => .named_pipe,
509 os.DT.LNK => .sym_link,
510 os.DT.REG => .file,
511 os.DT.SOCK => .unix_domain_socket,
512 os.DT.WHT => .whiteout,
513 else => .unknown,
514514 };
515515 return Entry{
516516 .name = name,
......@@ -595,14 +595,14 @@ pub const IterableDir = struct {
595595 }
596596 const statmode = stat_info.mode & os.S.IFMT;
597597
598 const entry_kind = switch (statmode) {
599 os.S.IFDIR => Entry.Kind.Directory,
600 os.S.IFBLK => Entry.Kind.BlockDevice,
601 os.S.IFCHR => Entry.Kind.CharacterDevice,
602 os.S.IFLNK => Entry.Kind.SymLink,
603 os.S.IFREG => Entry.Kind.File,
604 os.S.IFIFO => Entry.Kind.NamedPipe,
605 else => Entry.Kind.Unknown,
598 const entry_kind: Entry.Kind = switch (statmode) {
599 os.S.IFDIR => .directory,
600 os.S.IFBLK => .block_device,
601 os.S.IFCHR => .character_device,
602 os.S.IFLNK => .sym_link,
603 os.S.IFREG => .file,
604 os.S.IFIFO => .named_pipe,
605 else => .unknown,
606606 };
607607
608608 return Entry{
......@@ -679,15 +679,15 @@ pub const IterableDir = struct {
679679 continue :start_over;
680680 }
681681
682 const entry_kind = switch (linux_entry.d_type) {
683 linux.DT.BLK => Entry.Kind.BlockDevice,
684 linux.DT.CHR => Entry.Kind.CharacterDevice,
685 linux.DT.DIR => Entry.Kind.Directory,
686 linux.DT.FIFO => Entry.Kind.NamedPipe,
687 linux.DT.LNK => Entry.Kind.SymLink,
688 linux.DT.REG => Entry.Kind.File,
689 linux.DT.SOCK => Entry.Kind.UnixDomainSocket,
690 else => Entry.Kind.Unknown,
682 const entry_kind: Entry.Kind = switch (linux_entry.d_type) {
683 linux.DT.BLK => .block_device,
684 linux.DT.CHR => .character_device,
685 linux.DT.DIR => .directory,
686 linux.DT.FIFO => .named_pipe,
687 linux.DT.LNK => .sym_link,
688 linux.DT.REG => .file,
689 linux.DT.SOCK => .unix_domain_socket,
690 else => .unknown,
691691 };
692692 return Entry{
693693 .name = name,
......@@ -761,11 +761,11 @@ pub const IterableDir = struct {
761761 // Trust that Windows gives us valid UTF-16LE
762762 const name_utf8_len = std.unicode.utf16leToUtf8(self.name_data[0..], name_utf16le) catch unreachable;
763763 const name_utf8 = self.name_data[0..name_utf8_len];
764 const kind = blk: {
764 const kind: Entry.Kind = blk: {
765765 const attrs = dir_info.FileAttributes;
766 if (attrs & w.FILE_ATTRIBUTE_DIRECTORY != 0) break :blk Entry.Kind.Directory;
767 if (attrs & w.FILE_ATTRIBUTE_REPARSE_POINT != 0) break :blk Entry.Kind.SymLink;
768 break :blk Entry.Kind.File;
766 if (attrs & w.FILE_ATTRIBUTE_DIRECTORY != 0) break :blk .directory;
767 if (attrs & w.FILE_ATTRIBUTE_REPARSE_POINT != 0) break :blk .sym_link;
768 break :blk .file;
769769 };
770770 return Entry{
771771 .name = name_utf8,
......@@ -850,14 +850,14 @@ pub const IterableDir = struct {
850850 continue :start_over;
851851 }
852852
853 const entry_kind = switch (entry.d_type) {
854 .BLOCK_DEVICE => Entry.Kind.BlockDevice,
855 .CHARACTER_DEVICE => Entry.Kind.CharacterDevice,
856 .DIRECTORY => Entry.Kind.Directory,
857 .SYMBOLIC_LINK => Entry.Kind.SymLink,
858 .REGULAR_FILE => Entry.Kind.File,
859 .SOCKET_STREAM, .SOCKET_DGRAM => Entry.Kind.UnixDomainSocket,
860 else => Entry.Kind.Unknown,
853 const entry_kind: Entry.Kind = switch (entry.d_type) {
854 .BLOCK_DEVICE => .block_device,
855 .CHARACTER_DEVICE => .character_device,
856 .DIRECTORY => .directory,
857 .SYMBOLIC_LINK => .sym_link,
858 .REGULAR_FILE => .file,
859 .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket,
860 else => .unknown,
861861 };
862862 return Entry{
863863 .name = name,
......@@ -964,7 +964,7 @@ pub const IterableDir = struct {
964964 dirname_len += 1;
965965 }
966966 try self.name_buffer.appendSlice(base.name);
967 if (base.kind == .Directory) {
967 if (base.kind == .directory) {
968968 var new_dir = top.iter.dir.openIterableDir(base.name, .{}) catch |err| switch (err) {
969969 error.NameTooLong => unreachable, // no path sep in base.name
970970 else => |e| return e,
......@@ -2106,7 +2106,7 @@ pub const Dir = struct {
21062106 /// this function recursively removes its entries and then tries again.
21072107 /// This operation is not atomic on most file systems.
21082108 pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void {
2109 var initial_iterable_dir = (try self.deleteTreeOpenInitialSubpath(sub_path, .File)) orelse return;
2109 var initial_iterable_dir = (try self.deleteTreeOpenInitialSubpath(sub_path, .file)) orelse return;
21102110
21112111 const StackItem = struct {
21122112 name: []const u8,
......@@ -2130,7 +2130,7 @@ pub const Dir = struct {
21302130 process_stack: while (stack.len != 0) {
21312131 var top = &(stack.slice()[stack.len - 1]);
21322132 while (try top.iter.next()) |entry| {
2133 var treat_as_dir = entry.kind == .Directory;
2133 var treat_as_dir = entry.kind == .directory;
21342134 handle_entry: while (true) {
21352135 if (treat_as_dir) {
21362136 if (stack.ensureUnusedCapacity(1)) {
......@@ -2291,7 +2291,7 @@ pub const Dir = struct {
22912291 /// Like `deleteTree`, but only keeps one `Iterator` active at a time to minimize the function's stack size.
22922292 /// This is slower than `deleteTree` but uses less stack space.
22932293 pub fn deleteTreeMinStackSize(self: Dir, sub_path: []const u8) DeleteTreeError!void {
2294 return self.deleteTreeMinStackSizeWithKindHint(sub_path, .File);
2294 return self.deleteTreeMinStackSizeWithKindHint(sub_path, .file);
22952295 }
22962296
22972297 fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint: File.Kind) DeleteTreeError!void {
......@@ -2316,7 +2316,7 @@ pub const Dir = struct {
23162316 scan_dir: while (true) {
23172317 var dir_it = iterable_dir.iterateAssumeFirstIteration();
23182318 dir_it: while (try dir_it.next()) |entry| {
2319 var treat_as_dir = entry.kind == .Directory;
2319 var treat_as_dir = entry.kind == .directory;
23202320 handle_entry: while (true) {
23212321 if (treat_as_dir) {
23222322 const new_dir = iterable_dir.dir.openIterableDir(entry.name, .{ .no_follow = true }) catch |err| switch (err) {
......@@ -2407,7 +2407,7 @@ pub const Dir = struct {
24072407 fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File.Kind) !?IterableDir {
24082408 return iterable_dir: {
24092409 // Treat as a file by default
2410 var treat_as_dir = kind_hint == .Directory;
2410 var treat_as_dir = kind_hint == .directory;
24112411
24122412 handle_entry: while (true) {
24132413 if (treat_as_dir) {
lib/std/fs/file.zig+60-60
......@@ -35,17 +35,17 @@ pub const File = struct {
3535 pub const Gid = os.gid_t;
3636
3737 pub const Kind = enum {
38 BlockDevice,
39 CharacterDevice,
40 Directory,
41 NamedPipe,
42 SymLink,
43 File,
44 UnixDomainSocket,
45 Whiteout,
46 Door,
47 EventPort,
48 Unknown,
38 block_device,
39 character_device,
40 directory,
41 named_pipe,
42 sym_link,
43 file,
44 unix_domain_socket,
45 whiteout,
46 door,
47 event_port,
48 unknown,
4949 };
5050
5151 /// This is the default mode given to POSIX operating systems for creating
......@@ -329,32 +329,32 @@ pub const File = struct {
329329 const mtime = st.mtime();
330330 const ctime = st.ctime();
331331 const kind: Kind = if (builtin.os.tag == .wasi and !builtin.link_libc) switch (st.filetype) {
332 .BLOCK_DEVICE => Kind.BlockDevice,
333 .CHARACTER_DEVICE => Kind.CharacterDevice,
334 .DIRECTORY => Kind.Directory,
335 .SYMBOLIC_LINK => Kind.SymLink,
336 .REGULAR_FILE => Kind.File,
337 .SOCKET_STREAM, .SOCKET_DGRAM => Kind.UnixDomainSocket,
338 else => Kind.Unknown,
332 .BLOCK_DEVICE => .block_device,
333 .CHARACTER_DEVICE => .character_device,
334 .DIRECTORY => .directory,
335 .SYMBOLIC_LINK => .sym_link,
336 .REGULAR_FILE => .file,
337 .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket,
338 else => .unknown,
339339 } else blk: {
340340 const m = st.mode & os.S.IFMT;
341341 switch (m) {
342 os.S.IFBLK => break :blk Kind.BlockDevice,
343 os.S.IFCHR => break :blk Kind.CharacterDevice,
344 os.S.IFDIR => break :blk Kind.Directory,
345 os.S.IFIFO => break :blk Kind.NamedPipe,
346 os.S.IFLNK => break :blk Kind.SymLink,
347 os.S.IFREG => break :blk Kind.File,
348 os.S.IFSOCK => break :blk Kind.UnixDomainSocket,
342 os.S.IFBLK => break :blk .block_device,
343 os.S.IFCHR => break :blk .character_device,
344 os.S.IFDIR => break :blk .directory,
345 os.S.IFIFO => break :blk .named_pipe,
346 os.S.IFLNK => break :blk .sym_link,
347 os.S.IFREG => break :blk .file,
348 os.S.IFSOCK => break :blk .unix_domain_socket,
349349 else => {},
350350 }
351351 if (builtin.os.tag == .solaris) switch (m) {
352 os.S.IFDOOR => break :blk Kind.Door,
353 os.S.IFPORT => break :blk Kind.EventPort,
352 os.S.IFDOOR => break :blk .door,
353 os.S.IFPORT => break :blk .event_port,
354354 else => {},
355355 };
356356
357 break :blk .Unknown;
357 break :blk .unknown;
358358 };
359359
360360 return Stat{
......@@ -391,7 +391,7 @@ pub const File = struct {
391391 .inode = info.InternalInformation.IndexNumber,
392392 .size = @bitCast(u64, info.StandardInformation.EndOfFile),
393393 .mode = 0,
394 .kind = if (info.StandardInformation.Directory == 0) .File else .Directory,
394 .kind = if (info.StandardInformation.Directory == 0) .file else .directory,
395395 .atime = windows.fromSysTime(info.BasicInformation.LastAccessTime),
396396 .mtime = windows.fromSysTime(info.BasicInformation.LastWriteTime),
397397 .ctime = windows.fromSysTime(info.BasicInformation.CreationTime),
......@@ -609,7 +609,7 @@ pub const File = struct {
609609 }
610610
611611 /// Returns the `Kind` of file.
612 /// On Windows, can only return: `.File`, `.Directory`, `.SymLink` or `.Unknown`
612 /// On Windows, can only return: `.file`, `.directory`, `.sym_link` or `.unknown`
613613 pub fn kind(self: Self) Kind {
614614 return self.inner.kind();
615615 }
......@@ -652,35 +652,35 @@ pub const File = struct {
652652 /// Returns the `Kind` of the file
653653 pub fn kind(self: Self) Kind {
654654 if (builtin.os.tag == .wasi and !builtin.link_libc) return switch (self.stat.filetype) {
655 .BLOCK_DEVICE => Kind.BlockDevice,
656 .CHARACTER_DEVICE => Kind.CharacterDevice,
657 .DIRECTORY => Kind.Directory,
658 .SYMBOLIC_LINK => Kind.SymLink,
659 .REGULAR_FILE => Kind.File,
660 .SOCKET_STREAM, .SOCKET_DGRAM => Kind.UnixDomainSocket,
661 else => Kind.Unknown,
655 .BLOCK_DEVICE => .block_device,
656 .CHARACTER_DEVICE => .character_device,
657 .DIRECTORY => .directory,
658 .SYMBOLIC_LINK => .sym_link,
659 .REGULAR_FILE => .file,
660 .SOCKET_STREAM, .SOCKET_DGRAM => .unix_domain_socket,
661 else => .unknown,
662662 };
663663
664664 const m = self.stat.mode & os.S.IFMT;
665665
666666 switch (m) {
667 os.S.IFBLK => return Kind.BlockDevice,
668 os.S.IFCHR => return Kind.CharacterDevice,
669 os.S.IFDIR => return Kind.Directory,
670 os.S.IFIFO => return Kind.NamedPipe,
671 os.S.IFLNK => return Kind.SymLink,
672 os.S.IFREG => return Kind.File,
673 os.S.IFSOCK => return Kind.UnixDomainSocket,
667 os.S.IFBLK => return .block_device,
668 os.S.IFCHR => return .character_device,
669 os.S.IFDIR => return .directory,
670 os.S.IFIFO => return .named_pipe,
671 os.S.IFLNK => return .sym_link,
672 os.S.IFREG => return .file,
673 os.S.IFSOCK => return .unix_domain_socket,
674674 else => {},
675675 }
676676
677677 if (builtin.os.tag == .solaris) switch (m) {
678 os.S.IFDOOR => return Kind.Door,
679 os.S.IFPORT => return Kind.EventPort,
678 os.S.IFDOOR => return .door,
679 os.S.IFPORT => return .event_port,
680680 else => {},
681681 };
682682
683 return .Unknown;
683 return .unknown;
684684 }
685685
686686 /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01
......@@ -738,17 +738,17 @@ pub const File = struct {
738738 const m = self.statx.mode & os.S.IFMT;
739739
740740 switch (m) {
741 os.S.IFBLK => return Kind.BlockDevice,
742 os.S.IFCHR => return Kind.CharacterDevice,
743 os.S.IFDIR => return Kind.Directory,
744 os.S.IFIFO => return Kind.NamedPipe,
745 os.S.IFLNK => return Kind.SymLink,
746 os.S.IFREG => return Kind.File,
747 os.S.IFSOCK => return Kind.UnixDomainSocket,
741 os.S.IFBLK => return .block_device,
742 os.S.IFCHR => return .character_device,
743 os.S.IFDIR => return .directory,
744 os.S.IFIFO => return .named_pipe,
745 os.S.IFLNK => return .sym_link,
746 os.S.IFREG => return .file,
747 os.S.IFSOCK => return .unix_domain_socket,
748748 else => {},
749749 }
750750
751 return .Unknown;
751 return .unknown;
752752 }
753753
754754 /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01
......@@ -790,18 +790,18 @@ pub const File = struct {
790790 }
791791
792792 /// Returns the `Kind` of the file.
793 /// Can only return: `.File`, `.Directory`, `.SymLink` or `.Unknown`
793 /// Can only return: `.file`, `.directory`, `.sym_link` or `.unknown`
794794 pub fn kind(self: Self) Kind {
795795 if (self.attributes & windows.FILE_ATTRIBUTE_REPARSE_POINT != 0) {
796796 if (self.reparse_tag & 0x20000000 != 0) {
797 return .SymLink;
797 return .sym_link;
798798 }
799799 } else if (self.attributes & windows.FILE_ATTRIBUTE_DIRECTORY != 0) {
800 return .Directory;
800 return .directory;
801801 } else {
802 return .File;
802 return .file;
803803 }
804 return .Unknown;
804 return .unknown;
805805 }
806806
807807 /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01
lib/std/fs/test.zig+10-10
......@@ -179,8 +179,8 @@ test "Dir.Iterator" {
179179 }
180180
181181 try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..'
182 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File }));
183 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory }));
182 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file }));
183 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory }));
184184}
185185
186186test "Dir.Iterator many entries" {
......@@ -214,7 +214,7 @@ test "Dir.Iterator many entries" {
214214 i = 0;
215215 while (i < num) : (i += 1) {
216216 const name = try std.fmt.bufPrint(&buf, "{}", .{i});
217 try testing.expect(contains(&entries, .{ .name = name, .kind = .File }));
217 try testing.expect(contains(&entries, .{ .name = name, .kind = .file }));
218218 }
219219}
220220
......@@ -246,8 +246,8 @@ test "Dir.Iterator twice" {
246246 }
247247
248248 try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..'
249 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File }));
250 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory }));
249 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file }));
250 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory }));
251251 }
252252}
253253
......@@ -280,8 +280,8 @@ test "Dir.Iterator reset" {
280280 }
281281
282282 try testing.expect(entries.items.len == 2); // note that the Iterator skips '.' and '..'
283 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .File }));
284 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .Directory }));
283 try testing.expect(contains(&entries, .{ .name = "some_file", .kind = .file }));
284 try testing.expect(contains(&entries, .{ .name = "some_dir", .kind = .directory }));
285285
286286 iter.reset();
287287 }
......@@ -428,7 +428,7 @@ test "directory operations on files" {
428428 // ensure the file still exists and is a file as a sanity check
429429 file = try tmp_dir.dir.openFile(test_file_name, .{});
430430 const stat = try file.stat();
431 try testing.expect(stat.kind == .File);
431 try testing.expect(stat.kind == .file);
432432 file.close();
433433}
434434
......@@ -664,7 +664,7 @@ test "renameAbsolute" {
664664 try testing.expectError(error.FileNotFound, tmp_dir.dir.openFile(test_file_name, .{}));
665665 file = try tmp_dir.dir.openFile(renamed_test_file_name, .{});
666666 const stat = try file.stat();
667 try testing.expect(stat.kind == .File);
667 try testing.expect(stat.kind == .file);
668668 file.close();
669669
670670 // Renaming directories
......@@ -1348,7 +1348,7 @@ test "File.Metadata" {
13481348 defer file.close();
13491349
13501350 const metadata = try file.metadata();
1351 try testing.expect(metadata.kind() == .File);
1351 try testing.expect(metadata.kind() == .file);
13521352 try testing.expect(metadata.size() == 0);
13531353 _ = metadata.accessed();
13541354 _ = metadata.modified();
src/Package.zig+2-2
......@@ -651,8 +651,8 @@ fn computePackageHash(
651651
652652 while (try walker.next()) |entry| {
653653 switch (entry.kind) {
654 .Directory => continue,
655 .File => {},
654 .directory => continue,
655 .file => {},
656656 else => return error.IllegalFileTypeInPackage,
657657 }
658658 const hashed_file = try arena.create(HashedFile);
src/main.zig+3-3
......@@ -4830,11 +4830,11 @@ fn fmtPathDir(
48304830
48314831 var dir_it = iterable_dir.iterate();
48324832 while (try dir_it.next()) |entry| {
4833 const is_dir = entry.kind == .Directory;
4833 const is_dir = entry.kind == .directory;
48344834
48354835 if (is_dir and (mem.eql(u8, entry.name, "zig-cache") or mem.eql(u8, entry.name, "zig-out"))) continue;
48364836
4837 if (is_dir or entry.kind == .File and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) {
4837 if (is_dir or entry.kind == .file and (mem.endsWith(u8, entry.name, ".zig") or mem.endsWith(u8, entry.name, ".zon"))) {
48384838 const full_path = try fs.path.join(fmt.gpa, &[_][]const u8{ file_path, entry.name });
48394839 defer fmt.gpa.free(full_path);
48404840
......@@ -4864,7 +4864,7 @@ fn fmtPathFile(
48644864
48654865 const stat = try source_file.stat();
48664866
4867 if (stat.kind == .Directory)
4867 if (stat.kind == .directory)
48684868 return error.IsDir;
48694869
48704870 const gpa = fmt.gpa;
test/src/Cases.zig+2-2
......@@ -349,7 +349,7 @@ fn addFromDirInner(
349349 var filenames = std.ArrayList([]const u8).init(ctx.arena);
350350
351351 while (try it.next()) |entry| {
352 if (entry.kind != .File) continue;
352 if (entry.kind != .file) continue;
353353
354354 // Ignore stuff such as .swp files
355355 switch (Compilation.classifyFileExt(entry.basename)) {
......@@ -1039,7 +1039,7 @@ pub fn main() !void {
10391039 const stem = case_file_path[case_dirname.len + 1 .. case_file_path.len - "0.zig".len];
10401040 var it = iterable_dir.iterate();
10411041 while (try it.next()) |entry| {
1042 if (entry.kind != .File) continue;
1042 if (entry.kind != .file) continue;
10431043 if (!std.mem.startsWith(u8, entry.name, stem)) continue;
10441044 try filenames.append(try std.fs.path.join(arena, &.{ case_dirname, entry.name }));
10451045 }
tools/process_headers.zig+2-2
......@@ -393,8 +393,8 @@ pub fn main() !void {
393393 while (try dir_it.next()) |entry| {
394394 const full_path = try std.fs.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name });
395395 switch (entry.kind) {
396 .Directory => try dir_stack.append(full_path),
397 .File => {
396 .directory => try dir_stack.append(full_path),
397 .file => {
398398 const rel_path = try std.fs.path.relative(allocator, target_include_dir, full_path);
399399 const max_size = 2 * 1024 * 1024 * 1024;
400400 const raw_bytes = try std.fs.cwd().readFileAlloc(allocator, full_path, max_size);
tools/update-linux-headers.zig+2-2
......@@ -193,8 +193,8 @@ pub fn main() !void {
193193 while (try dir_it.next()) |entry| {
194194 const full_path = try std.fs.path.join(arena, &[_][]const u8{ full_dir_name, entry.name });
195195 switch (entry.kind) {
196 .Directory => try dir_stack.append(full_path),
197 .File => {
196 .directory => try dir_stack.append(full_path),
197 .file => {
198198 const rel_path = try std.fs.path.relative(arena, target_include_dir, full_path);
199199 const max_size = 2 * 1024 * 1024 * 1024;
200200 const raw_bytes = try std.fs.cwd().readFileAlloc(arena, full_path, max_size);
tools/update_glibc.zig+2-2
......@@ -57,7 +57,7 @@ pub fn main() !void {
5757 defer walker.deinit();
5858
5959 walk: while (try walker.next()) |entry| {
60 if (entry.kind != .File) continue;
60 if (entry.kind != .file) continue;
6161 if (mem.startsWith(u8, entry.basename, ".")) continue;
6262 for (exempt_files) |p| {
6363 if (mem.eql(u8, entry.path, p)) continue :walk;
......@@ -98,7 +98,7 @@ pub fn main() !void {
9898 defer walker.deinit();
9999
100100 walk: while (try walker.next()) |entry| {
101 if (entry.kind != .File) continue;
101 if (entry.kind != .file) continue;
102102 if (mem.startsWith(u8, entry.basename, ".")) continue;
103103 for (exempt_files) |p| {
104104 if (mem.eql(u8, entry.path, p)) continue :walk;
tools/update_spirv_features.zig+1-1
......@@ -227,7 +227,7 @@ fn gather_extensions(allocator: Allocator, spirv_registry_root: []const u8) ![]c
227227
228228 var vendor_it = extensions_dir.iterate();
229229 while (try vendor_it.next()) |vendor_entry| {
230 std.debug.assert(vendor_entry.kind == .Directory); // If this fails, the structure of SPIRV-Registry has changed.
230 std.debug.assert(vendor_entry.kind == .directory); // If this fails, the structure of SPIRV-Registry has changed.
231231
232232 const vendor_dir = try extensions_dir.dir.openIterableDir(vendor_entry.name, .{});
233233 var ext_it = vendor_dir.iterate();