| ... | ... | @@ -209,7 +209,7 @@ test "Dir.readLink" { |
| 209 | 209 | const file_target_path = try ctx.transformPath("file.txt"); |
| 210 | 210 | try ctx.dir.writeFile(io, .{ .sub_path = file_target_path, .data = "nonsense" }); |
| 211 | 211 | const dir_target_path = try ctx.transformPath("subdir"); |
| 212 | | try ctx.dir.makeDir(io, dir_target_path, .default_dir); |
| 212 | try ctx.dir.createDir(io, dir_target_path, .default_dir); |
| 213 | 213 | |
| 214 | 214 | // On Windows, symlink targets always use the canonical path separator |
| 215 | 215 | const canonical_file_target_path = try ctx.toCanonicalPathSep(file_target_path); |
| ... | ... | @@ -241,7 +241,7 @@ test "Dir.readLink on non-symlinks" { |
| 241 | 241 | const file_path = try ctx.transformPath("file.txt"); |
| 242 | 242 | try ctx.dir.writeFile(io, .{ .sub_path = file_path, .data = "nonsense" }); |
| 243 | 243 | const dir_path = try ctx.transformPath("subdir"); |
| 244 | | try ctx.dir.makeDir(io, dir_path, .default_dir); |
| 244 | try ctx.dir.createDir(io, dir_path, .default_dir); |
| 245 | 245 | |
| 246 | 246 | // file |
| 247 | 247 | var buffer: [Dir.max_path_bytes]u8 = undefined; |
| ... | ... | @@ -278,7 +278,7 @@ test "File.stat on a File that is a symlink returns Kind.sym_link" { |
| 278 | 278 | try testWithAllSupportedPathTypes(struct { |
| 279 | 279 | fn impl(ctx: *TestContext) !void { |
| 280 | 280 | const dir_target_path = try ctx.transformPath("subdir"); |
| 281 | | try ctx.dir.makeDir(io, dir_target_path, .default_dir); |
| 281 | try ctx.dir.createDir(io, dir_target_path, .default_dir); |
| 282 | 282 | |
| 283 | 283 | try setupSymlink(io, ctx.dir, dir_target_path, "symlink", .{ .is_directory = true }); |
| 284 | 284 | |
| ... | ... | @@ -301,7 +301,7 @@ test "openDir" { |
| 301 | 301 | fn impl(ctx: *TestContext) !void { |
| 302 | 302 | const allocator = ctx.arena.allocator(); |
| 303 | 303 | const subdir_path = try ctx.transformPath("subdir"); |
| 304 | | try ctx.dir.makeDir(io, subdir_path, .default_dir); |
| 304 | try ctx.dir.createDir(io, subdir_path, .default_dir); |
| 305 | 305 | |
| 306 | 306 | for ([_][]const u8{ "", ".", ".." }) |sub_path| { |
| 307 | 307 | const dir_path = try Dir.path.join(allocator, &.{ subdir_path, sub_path }); |
| ... | ... | @@ -340,7 +340,7 @@ test "openDirAbsolute" { |
| 340 | 340 | |
| 341 | 341 | const tmp_ino = (try tmp.dir.stat(io)).inode; |
| 342 | 342 | |
| 343 | | try tmp.dir.makeDir(io, "subdir", .default_dir); |
| 343 | try tmp.dir.createDir(io, "subdir", .default_dir); |
| 344 | 344 | const sub_path = try tmp.dir.realPathFileAlloc(io, "subdir", gpa); |
| 345 | 345 | defer gpa.free(sub_path); |
| 346 | 346 | |
| ... | ... | @@ -437,7 +437,7 @@ test "readLinkAbsolute" { |
| 437 | 437 | |
| 438 | 438 | // Create some targets |
| 439 | 439 | try tmp.dir.writeFile(io, .{ .sub_path = "file.txt", .data = "nonsense" }); |
| 440 | | try tmp.dir.makeDir(io, "subdir", .default_dir); |
| 440 | try tmp.dir.createDir(io, "subdir", .default_dir); |
| 441 | 441 | |
| 442 | 442 | // Get base abs path |
| 443 | 443 | var arena_allocator = ArenaAllocator.init(testing.allocator); |
| ... | ... | @@ -474,7 +474,7 @@ test "Dir.Iterator" { |
| 474 | 474 | const file = try tmp_dir.dir.createFile(io, "some_file", .{}); |
| 475 | 475 | file.close(io); |
| 476 | 476 | |
| 477 | | try tmp_dir.dir.makeDir(io, "some_dir", .default_dir); |
| 477 | try tmp_dir.dir.createDir(io, "some_dir", .default_dir); |
| 478 | 478 | |
| 479 | 479 | var arena = ArenaAllocator.init(testing.allocator); |
| 480 | 480 | defer arena.deinit(); |
| ... | ... | @@ -543,7 +543,7 @@ test "Dir.Iterator twice" { |
| 543 | 543 | const file = try tmp_dir.dir.createFile(io, "some_file", .{}); |
| 544 | 544 | file.close(io); |
| 545 | 545 | |
| 546 | | try tmp_dir.dir.makeDir(io, "some_dir", .default_dir); |
| 546 | try tmp_dir.dir.createDir(io, "some_dir", .default_dir); |
| 547 | 547 | |
| 548 | 548 | var arena = ArenaAllocator.init(testing.allocator); |
| 549 | 549 | defer arena.deinit(); |
| ... | ... | @@ -578,7 +578,7 @@ test "Dir.Iterator reset" { |
| 578 | 578 | const file = try tmp_dir.dir.createFile(io, "some_file", .{}); |
| 579 | 579 | file.close(io); |
| 580 | 580 | |
| 581 | | try tmp_dir.dir.makeDir(io, "some_dir", .default_dir); |
| 581 | try tmp_dir.dir.createDir(io, "some_dir", .default_dir); |
| 582 | 582 | |
| 583 | 583 | var arena = ArenaAllocator.init(testing.allocator); |
| 584 | 584 | defer arena.deinit(); |
| ... | ... | @@ -662,7 +662,7 @@ test "Dir.realPath smoke test" { |
| 662 | 662 | |
| 663 | 663 | // Now create the file and dir |
| 664 | 664 | try ctx.dir.writeFile(io, .{ .sub_path = test_file_path, .data = "" }); |
| 665 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 665 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 666 | 666 | |
| 667 | 667 | const base_path = try ctx.transformPath("."); |
| 668 | 668 | const base_realpath = try ctx.dir.realPathFileAlloc(io, base_path, arena); |
| ... | ... | @@ -754,7 +754,7 @@ test "Dir.statFile" { |
| 754 | 754 | |
| 755 | 755 | try expectError(error.FileNotFound, ctx.dir.statFile(io, test_dir_name, .{})); |
| 756 | 756 | |
| 757 | | try ctx.dir.makeDir(io, test_dir_name, .default_dir); |
| 757 | try ctx.dir.createDir(io, test_dir_name, .default_dir); |
| 758 | 758 | |
| 759 | 759 | const stat = try ctx.dir.statFile(io, test_dir_name, .{}); |
| 760 | 760 | try expectEqual(.directory, stat.kind); |
| ... | ... | @@ -787,12 +787,12 @@ test "directory operations on files" { |
| 787 | 787 | var file = try ctx.dir.createFile(io, test_file_name, .{ .read = true }); |
| 788 | 788 | file.close(io); |
| 789 | 789 | |
| 790 | | try expectError(error.PathAlreadyExists, ctx.dir.makeDir(io, test_file_name, .default_dir)); |
| 790 | try expectError(error.PathAlreadyExists, ctx.dir.createDir(io, test_file_name, .default_dir)); |
| 791 | 791 | try expectError(error.NotDir, ctx.dir.openDir(io, test_file_name, .{})); |
| 792 | 792 | try expectError(error.NotDir, ctx.dir.deleteDir(io, test_file_name)); |
| 793 | 793 | |
| 794 | 794 | if (ctx.path_type == .absolute and comptime PathType.absolute.isSupported(builtin.os)) { |
| 795 | | try expectError(error.PathAlreadyExists, Dir.makeDirAbsolute(io, test_file_name, .default_dir)); |
| 795 | try expectError(error.PathAlreadyExists, Dir.createDirAbsolute(io, test_file_name, .default_dir)); |
| 796 | 796 | try expectError(error.NotDir, Dir.deleteDirAbsolute(io, test_file_name)); |
| 797 | 797 | } |
| 798 | 798 | |
| ... | ... | @@ -815,7 +815,7 @@ test "file operations on directories" { |
| 815 | 815 | fn impl(ctx: *TestContext) !void { |
| 816 | 816 | const test_dir_name = try ctx.transformPath("test_dir"); |
| 817 | 817 | |
| 818 | | try ctx.dir.makeDir(io, test_dir_name, .default_dir); |
| 818 | try ctx.dir.createDir(io, test_dir_name, .default_dir); |
| 819 | 819 | |
| 820 | 820 | try expectError(error.IsDir, ctx.dir.createFile(io, test_dir_name, .{})); |
| 821 | 821 | try expectError(error.IsDir, ctx.dir.deleteFile(io, test_dir_name)); |
| ... | ... | @@ -887,7 +887,7 @@ test "deleteDir" { |
| 887 | 887 | try expectError(error.FileNotFound, ctx.dir.deleteDir(io, test_dir_path)); |
| 888 | 888 | |
| 889 | 889 | // deleting a non-empty directory |
| 890 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 890 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 891 | 891 | try ctx.dir.writeFile(io, .{ .sub_path = test_file_path, .data = "" }); |
| 892 | 892 | try expectError(error.DirNotEmpty, ctx.dir.deleteDir(io, test_dir_path)); |
| 893 | 893 | |
| ... | ... | @@ -956,7 +956,7 @@ test "Dir.rename directories" { |
| 956 | 956 | const test_dir_renamed_path = try ctx.transformPath("test_dir_renamed"); |
| 957 | 957 | |
| 958 | 958 | // Renaming directories |
| 959 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 959 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 960 | 960 | try ctx.dir.rename(test_dir_path, ctx.dir, test_dir_renamed_path, io); |
| 961 | 961 | |
| 962 | 962 | // Ensure the directory was renamed |
| ... | ... | @@ -992,8 +992,8 @@ test "Dir.rename directory onto empty dir" { |
| 992 | 992 | const test_dir_path = try ctx.transformPath("test_dir"); |
| 993 | 993 | const target_dir_path = try ctx.transformPath("target_dir_path"); |
| 994 | 994 | |
| 995 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 996 | | try ctx.dir.makeDir(io, target_dir_path, .default_dir); |
| 995 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 996 | try ctx.dir.createDir(io, target_dir_path, .default_dir); |
| 997 | 997 | try ctx.dir.rename(test_dir_path, ctx.dir, target_dir_path, io); |
| 998 | 998 | |
| 999 | 999 | // Ensure the directory was renamed |
| ... | ... | @@ -1014,7 +1014,7 @@ test "Dir.rename directory onto non-empty dir" { |
| 1014 | 1014 | const test_dir_path = try ctx.transformPath("test_dir"); |
| 1015 | 1015 | const target_dir_path = try ctx.transformPath("target_dir_path"); |
| 1016 | 1016 | |
| 1017 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 1017 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 1018 | 1018 | |
| 1019 | 1019 | var target_dir = try ctx.dir.makeOpenPath(io, target_dir_path, .{}); |
| 1020 | 1020 | var file = try target_dir.createFile(io, "test_file", .{ .read = true }); |
| ... | ... | @@ -1043,7 +1043,7 @@ test "Dir.rename file <-> dir" { |
| 1043 | 1043 | |
| 1044 | 1044 | var file = try ctx.dir.createFile(io, test_file_path, .{ .read = true }); |
| 1045 | 1045 | file.close(io); |
| 1046 | | try ctx.dir.makeDir(io, test_dir_path, .default_dir); |
| 1046 | try ctx.dir.createDir(io, test_dir_path, .default_dir); |
| 1047 | 1047 | try expectError(error.IsDir, ctx.dir.rename(test_file_path, ctx.dir, test_dir_path, io)); |
| 1048 | 1048 | try expectError(error.NotDir, ctx.dir.rename(test_dir_path, ctx.dir, test_file_path, io)); |
| 1049 | 1049 | } |
| ... | ... | @@ -1115,7 +1115,7 @@ test "renameAbsolute" { |
| 1115 | 1115 | // Renaming directories |
| 1116 | 1116 | const test_dir_name = "test_dir"; |
| 1117 | 1117 | const renamed_test_dir_name = "test_dir_renamed"; |
| 1118 | | try tmp_dir.dir.makeDir(io, test_dir_name, .default_dir); |
| 1118 | try tmp_dir.dir.createDir(io, test_dir_name, .default_dir); |
| 1119 | 1119 | try Dir.renameAbsolute( |
| 1120 | 1120 | try Dir.path.join(allocator, &.{ base_path, test_dir_name }), |
| 1121 | 1121 | try Dir.path.join(allocator, &.{ base_path, renamed_test_dir_name }), |
| ... | ... | @@ -1256,7 +1256,7 @@ test "makePath but sub_path contains pre-existing file" { |
| 1256 | 1256 | var tmp = tmpDir(.{}); |
| 1257 | 1257 | defer tmp.cleanup(); |
| 1258 | 1258 | |
| 1259 | | try tmp.dir.makeDir(io, "foo", .default_dir); |
| 1259 | try tmp.dir.createDir(io, "foo", .default_dir); |
| 1260 | 1260 | try tmp.dir.writeFile(io, .{ .sub_path = "foo/bar", .data = "" }); |
| 1261 | 1261 | |
| 1262 | 1262 | try expectError(error.NotDir, tmp.dir.makePath(io, "foo/bar/baz")); |
| ... | ... | @@ -1273,10 +1273,10 @@ test "makepath existing directories" { |
| 1273 | 1273 | var tmp = tmpDir(.{}); |
| 1274 | 1274 | defer tmp.cleanup(); |
| 1275 | 1275 | |
| 1276 | | try tmp.dir.makeDir(io, "A", .default_dir); |
| 1276 | try tmp.dir.createDir(io, "A", .default_dir); |
| 1277 | 1277 | var tmpA = try tmp.dir.openDir(io, "A", .{}); |
| 1278 | 1278 | defer tmpA.close(io); |
| 1279 | | try tmpA.makeDir(io, "B", .default_dir); |
| 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 | 1282 | try tmp.dir.makePath(io, testPath); |
| ... | ... | @@ -1290,7 +1290,7 @@ test "makepath through existing valid symlink" { |
| 1290 | 1290 | var tmp = tmpDir(.{}); |
| 1291 | 1291 | defer tmp.cleanup(); |
| 1292 | 1292 | |
| 1293 | | try tmp.dir.makeDir(io, "realfolder", .default_dir); |
| 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 | 1296 | try tmp.dir.makePath(io, "working-symlink" ++ Dir.path.sep_str ++ "in-realfolder"); |
| ... | ... | @@ -1985,7 +1985,7 @@ test "'.' and '..' in Dir functions" { |
| 1985 | 1985 | const rename_path = try ctx.transformPath("./subdir/../rename"); |
| 1986 | 1986 | const update_path = try ctx.transformPath("./subdir/../update"); |
| 1987 | 1987 | |
| 1988 | | try ctx.dir.makeDir(io, subdir_path, .default_dir); |
| 1988 | try ctx.dir.createDir(io, subdir_path, .default_dir); |
| 1989 | 1989 | try ctx.dir.access(io, subdir_path, .{}); |
| 1990 | 1990 | var created_subdir = try ctx.dir.openDir(io, subdir_path, .{}); |
| 1991 | 1991 | created_subdir.close(io); |
| ... | ... | @@ -2026,7 +2026,7 @@ test "'.' and '..' in absolute functions" { |
| 2026 | 2026 | const base_path = try tmp.dir.realPathFileAlloc(io, ".", allocator); |
| 2027 | 2027 | |
| 2028 | 2028 | const subdir_path = try Dir.path.join(allocator, &.{ base_path, "./subdir" }); |
| 2029 | | try Dir.makeDirAbsolute(io, subdir_path, .default_dir); |
| 2029 | try Dir.createDirAbsolute(io, subdir_path, .default_dir); |
| 2030 | 2030 | try Dir.accessAbsolute(io, subdir_path, .{}); |
| 2031 | 2031 | var created_subdir = try Dir.openDirAbsolute(io, subdir_path, .{}); |
| 2032 | 2032 | created_subdir.close(io); |
| ... | ... | @@ -2062,7 +2062,7 @@ test "chmod" { |
| 2062 | 2062 | try file.setPermissions(io, .fromMode(0o644)); |
| 2063 | 2063 | try expectEqual(0o644, (try file.stat(io)).permissions.toMode() & 0o7777); |
| 2064 | 2064 | |
| 2065 | | try tmp.dir.makeDir(io, "test_dir", .default_dir); |
| 2065 | try tmp.dir.createDir(io, "test_dir", .default_dir); |
| 2066 | 2066 | var dir = try tmp.dir.openDir(io, "test_dir", .{ .iterate = true }); |
| 2067 | 2067 | defer dir.close(io); |
| 2068 | 2068 | |
| ... | ... | @@ -2083,7 +2083,7 @@ test "change ownership" { |
| 2083 | 2083 | defer file.close(io); |
| 2084 | 2084 | try file.setOwner(io, null, null); |
| 2085 | 2085 | |
| 2086 | | try tmp.dir.makeDir(io, "test_dir", .default_dir); |
| 2086 | try tmp.dir.createDir(io, "test_dir", .default_dir); |
| 2087 | 2087 | |
| 2088 | 2088 | var dir = try tmp.dir.openDir(io, "test_dir", .{ .iterate = true }); |
| 2089 | 2089 | defer dir.close(io); |
| ... | ... | @@ -2107,7 +2107,7 @@ test "invalid UTF-8/WTF-8 paths" { |
| 2107 | 2107 | |
| 2108 | 2108 | try expectError(expected_err, ctx.dir.createFile(io, invalid_path, .{})); |
| 2109 | 2109 | |
| 2110 | | try expectError(expected_err, ctx.dir.makeDir(io, invalid_path, .default_dir)); |
| 2110 | try expectError(expected_err, ctx.dir.createDir(io, invalid_path, .default_dir)); |
| 2111 | 2111 | |
| 2112 | 2112 | try expectError(expected_err, ctx.dir.makePath(io, invalid_path)); |
| 2113 | 2113 | try expectError(expected_err, ctx.dir.makeOpenPath(io, invalid_path, .{})); |
| ... | ... | @@ -2150,7 +2150,7 @@ test "invalid UTF-8/WTF-8 paths" { |
| 2150 | 2150 | if (native_os != .wasi and ctx.path_type != .relative) { |
| 2151 | 2151 | var buf: [Dir.max_path_bytes]u8 = undefined; |
| 2152 | 2152 | try expectError(expected_err, Dir.copyFileAbsolute(invalid_path, invalid_path, io, .{})); |
| 2153 | | try expectError(expected_err, Dir.makeDirAbsolute(io, invalid_path, .default_dir)); |
| 2153 | try expectError(expected_err, Dir.createDirAbsolute(io, invalid_path, .default_dir)); |
| 2154 | 2154 | try expectError(expected_err, Dir.deleteDirAbsolute(io, invalid_path)); |
| 2155 | 2155 | try expectError(expected_err, Dir.renameAbsolute(invalid_path, invalid_path, io)); |
| 2156 | 2156 | try expectError(expected_err, Dir.openDirAbsolute(io, invalid_path, .{})); |
| ... | ... | @@ -2496,7 +2496,7 @@ test "access smoke test" { |
| 2496 | 2496 | |
| 2497 | 2497 | { |
| 2498 | 2498 | // Create some directory |
| 2499 | | try tmp.dir.makeDir(io, "some_dir", .default_dir); |
| 2499 | try tmp.dir.createDir(io, "some_dir", .default_dir); |
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | { |
| ... | ... | @@ -2552,7 +2552,7 @@ test "open smoke test" { |
| 2552 | 2552 | } |
| 2553 | 2553 | |
| 2554 | 2554 | try expectError(error.NotDir, tmp.dir.openDir(io, "some_file", .{})); |
| 2555 | | try tmp.dir.makeDir(io, "some_dir", .default_dir); |
| 2555 | try tmp.dir.createDir(io, "some_dir", .default_dir); |
| 2556 | 2556 | |
| 2557 | 2557 | { |
| 2558 | 2558 | const dir = try tmp.dir.openDir(io, "some_dir", .{}); |