| ... | @@ -163,12 +163,12 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo | ... | @@ -163,12 +163,12 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo |
| 163 | test "openDir" { | 163 | test "openDir" { |
| 164 | try testWithAllSupportedPathTypes(struct { | 164 | try testWithAllSupportedPathTypes(struct { |
| 165 | fn impl(ctx: *TestContext) !void { | 165 | fn impl(ctx: *TestContext) !void { |
| | 166 | const allocator = ctx.arena.allocator(); |
| 166 | const subdir_path = try ctx.transformPath("subdir"); | 167 | const subdir_path = try ctx.transformPath("subdir"); |
| 167 | try ctx.dir.makeDir(subdir_path); | 168 | try ctx.dir.makeDir(subdir_path); |
| 168 | | 169 | |
| 169 | for ([_][]const u8{ "", ".", ".." }) |sub_path| { | 170 | for ([_][]const u8{ "", ".", ".." }) |sub_path| { |
| 170 | const dir_path = try fs.path.join(testing.allocator, &[_][]const u8{ subdir_path, sub_path }); | 171 | const dir_path = try fs.path.join(allocator, &.{ subdir_path, sub_path }); |
| 171 | defer testing.allocator.free(dir_path); | | |
| 172 | var dir = try ctx.dir.openDir(dir_path, .{}); | 172 | var dir = try ctx.dir.openDir(dir_path, .{}); |
| 173 | defer dir.close(); | 173 | defer dir.close(); |
| 174 | } | 174 | } |
| ... | @@ -187,7 +187,7 @@ test "accessAbsolute" { | ... | @@ -187,7 +187,7 @@ test "accessAbsolute" { |
| 187 | const allocator = arena.allocator(); | 187 | const allocator = arena.allocator(); |
| 188 | | 188 | |
| 189 | const base_path = blk: { | 189 | const base_path = blk: { |
| 190 | const relative_path = try fs.path.join(allocator, &[_][]const u8{ "zig-cache", "tmp", tmp.sub_path[0..] }); | 190 | const relative_path = try fs.path.join(allocator, &.{ "zig-cache", "tmp", tmp.sub_path[0..] }); |
| 191 | break :blk try fs.realpathAlloc(allocator, relative_path); | 191 | break :blk try fs.realpathAlloc(allocator, relative_path); |
| 192 | }; | 192 | }; |
| 193 | | 193 | |
| ... | @@ -206,7 +206,7 @@ test "openDirAbsolute" { | ... | @@ -206,7 +206,7 @@ test "openDirAbsolute" { |
| 206 | const allocator = arena.allocator(); | 206 | const allocator = arena.allocator(); |
| 207 | | 207 | |
| 208 | const base_path = blk: { | 208 | const base_path = blk: { |
| 209 | const relative_path = try fs.path.join(allocator, &[_][]const u8{ "zig-cache", "tmp", tmp.sub_path[0..], "subdir" }); | 209 | const relative_path = try fs.path.join(allocator, &.{ "zig-cache", "tmp", tmp.sub_path[0..], "subdir" }); |
| 210 | break :blk try fs.realpathAlloc(allocator, relative_path); | 210 | break :blk try fs.realpathAlloc(allocator, relative_path); |
| 211 | }; | 211 | }; |
| 212 | | 212 | |
| ... | @@ -216,8 +216,7 @@ test "openDirAbsolute" { | ... | @@ -216,8 +216,7 @@ test "openDirAbsolute" { |
| 216 | } | 216 | } |
| 217 | | 217 | |
| 218 | for ([_][]const u8{ ".", ".." }) |sub_path| { | 218 | for ([_][]const u8{ ".", ".." }) |sub_path| { |
| 219 | const dir_path = try fs.path.join(allocator, &[_][]const u8{ base_path, sub_path }); | 219 | const dir_path = try fs.path.join(allocator, &.{ base_path, sub_path }); |
| 220 | defer allocator.free(dir_path); | | |
| 221 | var dir = try fs.openDirAbsolute(dir_path, .{}); | 220 | var dir = try fs.openDirAbsolute(dir_path, .{}); |
| 222 | defer dir.close(); | 221 | defer dir.close(); |
| 223 | } | 222 | } |
| ... | @@ -270,13 +269,13 @@ test "readLinkAbsolute" { | ... | @@ -270,13 +269,13 @@ test "readLinkAbsolute" { |
| 270 | const allocator = arena.allocator(); | 269 | const allocator = arena.allocator(); |
| 271 | | 270 | |
| 272 | const base_path = blk: { | 271 | const base_path = blk: { |
| 273 | const relative_path = try fs.path.join(allocator, &[_][]const u8{ "zig-cache", "tmp", tmp.sub_path[0..] }); | 272 | const relative_path = try fs.path.join(allocator, &.{ "zig-cache", "tmp", tmp.sub_path[0..] }); |
| 274 | break :blk try fs.realpathAlloc(allocator, relative_path); | 273 | break :blk try fs.realpathAlloc(allocator, relative_path); |
| 275 | }; | 274 | }; |
| 276 | | 275 | |
| 277 | { | 276 | { |
| 278 | const target_path = try fs.path.join(allocator, &[_][]const u8{ base_path, "file.txt" }); | 277 | const target_path = try fs.path.join(allocator, &.{ base_path, "file.txt" }); |
| 279 | const symlink_path = try fs.path.join(allocator, &[_][]const u8{ base_path, "symlink1" }); | 278 | const symlink_path = try fs.path.join(allocator, &.{ base_path, "symlink1" }); |
| 280 | | 279 | |
| 281 | // Create symbolic link by path | 280 | // Create symbolic link by path |
| 282 | fs.symLinkAbsolute(target_path, symlink_path, .{}) catch |err| switch (err) { | 281 | fs.symLinkAbsolute(target_path, symlink_path, .{}) catch |err| switch (err) { |
| ... | @@ -287,8 +286,8 @@ test "readLinkAbsolute" { | ... | @@ -287,8 +286,8 @@ test "readLinkAbsolute" { |
| 287 | try testReadLinkAbsolute(target_path, symlink_path); | 286 | try testReadLinkAbsolute(target_path, symlink_path); |
| 288 | } | 287 | } |
| 289 | { | 288 | { |
| 290 | const target_path = try fs.path.join(allocator, &[_][]const u8{ base_path, "subdir" }); | 289 | const target_path = try fs.path.join(allocator, &.{ base_path, "subdir" }); |
| 291 | const symlink_path = try fs.path.join(allocator, &[_][]const u8{ base_path, "symlink2" }); | 290 | const symlink_path = try fs.path.join(allocator, &.{ base_path, "symlink2" }); |
| 292 | | 291 | |
| 293 | // Create symbolic link by path | 292 | // Create symbolic link by path |
| 294 | fs.symLinkAbsolute(target_path, symlink_path, .{ .is_directory = true }) catch |err| switch (err) { | 293 | fs.symLinkAbsolute(target_path, symlink_path, .{ .is_directory = true }) catch |err| switch (err) { |
| ... | @@ -485,14 +484,15 @@ test "Dir.realpath smoke test" { | ... | @@ -485,14 +484,15 @@ test "Dir.realpath smoke test" { |
| 485 | | 484 | |
| 486 | try testWithAllSupportedPathTypes(struct { | 485 | try testWithAllSupportedPathTypes(struct { |
| 487 | fn impl(ctx: *TestContext) !void { | 486 | fn impl(ctx: *TestContext) !void { |
| | 487 | const allocator = ctx.arena.allocator(); |
| 488 | const test_file_path = try ctx.transformPath("test_file"); | 488 | const test_file_path = try ctx.transformPath("test_file"); |
| 489 | const test_dir_path = try ctx.transformPath("test_dir"); | 489 | const test_dir_path = try ctx.transformPath("test_dir"); |
| 490 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | 490 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; |
| 491 | | 491 | |
| 492 | // FileNotFound if the path doesn't exist | 492 | // FileNotFound if the path doesn't exist |
| 493 | try testing.expectError(error.FileNotFound, ctx.dir.realpathAlloc(testing.allocator, test_file_path)); | 493 | try testing.expectError(error.FileNotFound, ctx.dir.realpathAlloc(allocator, test_file_path)); |
| 494 | try testing.expectError(error.FileNotFound, ctx.dir.realpath(test_file_path, &buf)); | 494 | try testing.expectError(error.FileNotFound, ctx.dir.realpath(test_file_path, &buf)); |
| 495 | try testing.expectError(error.FileNotFound, ctx.dir.realpathAlloc(testing.allocator, test_dir_path)); | 495 | try testing.expectError(error.FileNotFound, ctx.dir.realpathAlloc(allocator, test_dir_path)); |
| 496 | try testing.expectError(error.FileNotFound, ctx.dir.realpath(test_dir_path, &buf)); | 496 | try testing.expectError(error.FileNotFound, ctx.dir.realpath(test_dir_path, &buf)); |
| 497 | | 497 | |
| 498 | // Now create the file and dir | 498 | // Now create the file and dir |
| ... | @@ -500,18 +500,15 @@ test "Dir.realpath smoke test" { | ... | @@ -500,18 +500,15 @@ test "Dir.realpath smoke test" { |
| 500 | try ctx.dir.makeDir(test_dir_path); | 500 | try ctx.dir.makeDir(test_dir_path); |
| 501 | | 501 | |
| 502 | const base_path = try ctx.transformPath("."); | 502 | const base_path = try ctx.transformPath("."); |
| 503 | const base_realpath = try ctx.dir.realpathAlloc(testing.allocator, base_path); | 503 | const base_realpath = try ctx.dir.realpathAlloc(allocator, base_path); |
| 504 | defer testing.allocator.free(base_realpath); | | |
| 505 | const expected_file_path = try fs.path.join( | 504 | const expected_file_path = try fs.path.join( |
| 506 | testing.allocator, | 505 | allocator, |
| 507 | &[_][]const u8{ base_realpath, "test_file" }, | 506 | &.{ base_realpath, "test_file" }, |
| 508 | ); | 507 | ); |
| 509 | defer testing.allocator.free(expected_file_path); | | |
| 510 | const expected_dir_path = try fs.path.join( | 508 | const expected_dir_path = try fs.path.join( |
| 511 | testing.allocator, | 509 | allocator, |
| 512 | &[_][]const u8{ base_realpath, "test_dir" }, | 510 | &.{ base_realpath, "test_dir" }, |
| 513 | ); | 511 | ); |
| 514 | defer testing.allocator.free(expected_dir_path); | | |
| 515 | | 512 | |
| 516 | // First, test non-alloc version | 513 | // First, test non-alloc version |
| 517 | { | 514 | { |
| ... | @@ -524,12 +521,10 @@ test "Dir.realpath smoke test" { | ... | @@ -524,12 +521,10 @@ test "Dir.realpath smoke test" { |
| 524 | | 521 | |
| 525 | // Next, test alloc version | 522 | // Next, test alloc version |
| 526 | { | 523 | { |
| 527 | const file_path = try ctx.dir.realpathAlloc(testing.allocator, test_file_path); | 524 | const file_path = try ctx.dir.realpathAlloc(allocator, test_file_path); |
| 528 | defer testing.allocator.free(file_path); | | |
| 529 | try testing.expectEqualStrings(expected_file_path, file_path); | 525 | try testing.expectEqualStrings(expected_file_path, file_path); |
| 530 | | 526 | |
| 531 | const dir_path = try ctx.dir.realpathAlloc(testing.allocator, test_dir_path); | 527 | const dir_path = try ctx.dir.realpathAlloc(allocator, test_dir_path); |
| 532 | defer testing.allocator.free(dir_path); | | |
| 533 | try testing.expectEqualStrings(expected_dir_path, dir_path); | 528 | try testing.expectEqualStrings(expected_dir_path, dir_path); |
| 534 | } | 529 | } |
| 535 | } | 530 | } |
| ... | @@ -849,13 +844,13 @@ test "renameAbsolute" { | ... | @@ -849,13 +844,13 @@ test "renameAbsolute" { |
| 849 | const allocator = arena.allocator(); | 844 | const allocator = arena.allocator(); |
| 850 | | 845 | |
| 851 | const base_path = blk: { | 846 | const base_path = blk: { |
| 852 | const relative_path = try fs.path.join(allocator, &[_][]const u8{ "zig-cache", "tmp", tmp_dir.sub_path[0..] }); | 847 | const relative_path = try fs.path.join(allocator, &.{ "zig-cache", "tmp", tmp_dir.sub_path[0..] }); |
| 853 | break :blk try fs.realpathAlloc(allocator, relative_path); | 848 | break :blk try fs.realpathAlloc(allocator, relative_path); |
| 854 | }; | 849 | }; |
| 855 | | 850 | |
| 856 | try testing.expectError(error.FileNotFound, fs.renameAbsolute( | 851 | try testing.expectError(error.FileNotFound, fs.renameAbsolute( |
| 857 | try fs.path.join(allocator, &[_][]const u8{ base_path, "missing_file_name" }), | 852 | try fs.path.join(allocator, &.{ base_path, "missing_file_name" }), |
| 858 | try fs.path.join(allocator, &[_][]const u8{ base_path, "something_else" }), | 853 | try fs.path.join(allocator, &.{ base_path, "something_else" }), |
| 859 | )); | 854 | )); |
| 860 | | 855 | |
| 861 | // Renaming files | 856 | // Renaming files |
| ... | @@ -864,8 +859,8 @@ test "renameAbsolute" { | ... | @@ -864,8 +859,8 @@ test "renameAbsolute" { |
| 864 | var file = try tmp_dir.dir.createFile(test_file_name, .{ .read = true }); | 859 | var file = try tmp_dir.dir.createFile(test_file_name, .{ .read = true }); |
| 865 | file.close(); | 860 | file.close(); |
| 866 | try fs.renameAbsolute( | 861 | try fs.renameAbsolute( |
| 867 | try fs.path.join(allocator, &[_][]const u8{ base_path, test_file_name }), | 862 | try fs.path.join(allocator, &.{ base_path, test_file_name }), |
| 868 | try fs.path.join(allocator, &[_][]const u8{ base_path, renamed_test_file_name }), | 863 | try fs.path.join(allocator, &.{ base_path, renamed_test_file_name }), |
| 869 | ); | 864 | ); |
| 870 | | 865 | |
| 871 | // ensure the file was renamed | 866 | // ensure the file was renamed |
| ... | @@ -880,8 +875,8 @@ test "renameAbsolute" { | ... | @@ -880,8 +875,8 @@ test "renameAbsolute" { |
| 880 | const renamed_test_dir_name = "test_dir_renamed"; | 875 | const renamed_test_dir_name = "test_dir_renamed"; |
| 881 | try tmp_dir.dir.makeDir(test_dir_name); | 876 | try tmp_dir.dir.makeDir(test_dir_name); |
| 882 | try fs.renameAbsolute( | 877 | try fs.renameAbsolute( |
| 883 | try fs.path.join(allocator, &[_][]const u8{ base_path, test_dir_name }), | 878 | try fs.path.join(allocator, &.{ base_path, test_dir_name }), |
| 884 | try fs.path.join(allocator, &[_][]const u8{ base_path, renamed_test_dir_name }), | 879 | try fs.path.join(allocator, &.{ base_path, renamed_test_dir_name }), |
| 885 | ); | 880 | ); |
| 886 | | 881 | |
| 887 | // ensure the directory was renamed | 882 | // ensure the directory was renamed |
| ... | @@ -900,11 +895,12 @@ test "openSelfExe" { | ... | @@ -900,11 +895,12 @@ test "openSelfExe" { |
| 900 | test "makePath, put some files in it, deleteTree" { | 895 | test "makePath, put some files in it, deleteTree" { |
| 901 | try testWithAllSupportedPathTypes(struct { | 896 | try testWithAllSupportedPathTypes(struct { |
| 902 | fn impl(ctx: *TestContext) !void { | 897 | fn impl(ctx: *TestContext) !void { |
| | 898 | const allocator = ctx.arena.allocator(); |
| 903 | const dir_path = try ctx.transformPath("os_test_tmp"); | 899 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| 904 | | 900 | |
| 905 | try ctx.dir.makePath("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c"); | 901 | try ctx.dir.makePath(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "c" })); |
| 906 | try ctx.dir.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c" ++ fs.path.sep_str ++ "file.txt", "nonsense"); | 902 | try ctx.dir.writeFile(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }), "nonsense"); |
| 907 | try ctx.dir.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah"); | 903 | try ctx.dir.writeFile(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "file2.txt" }), "blah"); |
| 908 | | 904 | |
| 909 | try ctx.dir.deleteTree(dir_path); | 905 | try ctx.dir.deleteTree(dir_path); |
| 910 | try testing.expectError(error.FileNotFound, ctx.dir.openDir(dir_path, .{})); | 906 | try testing.expectError(error.FileNotFound, ctx.dir.openDir(dir_path, .{})); |
| ... | @@ -915,11 +911,12 @@ test "makePath, put some files in it, deleteTree" { | ... | @@ -915,11 +911,12 @@ test "makePath, put some files in it, deleteTree" { |
| 915 | test "makePath, put some files in it, deleteTreeMinStackSize" { | 911 | test "makePath, put some files in it, deleteTreeMinStackSize" { |
| 916 | try testWithAllSupportedPathTypes(struct { | 912 | try testWithAllSupportedPathTypes(struct { |
| 917 | fn impl(ctx: *TestContext) !void { | 913 | fn impl(ctx: *TestContext) !void { |
| | 914 | const allocator = ctx.arena.allocator(); |
| 918 | const dir_path = try ctx.transformPath("os_test_tmp"); | 915 | const dir_path = try ctx.transformPath("os_test_tmp"); |
| 919 | | 916 | |
| 920 | try ctx.dir.makePath("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c"); | 917 | try ctx.dir.makePath(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "c" })); |
| 921 | try ctx.dir.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c" ++ fs.path.sep_str ++ "file.txt", "nonsense"); | 918 | try ctx.dir.writeFile(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "c", "file.txt" }), "nonsense"); |
| 922 | try ctx.dir.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah"); | 919 | try ctx.dir.writeFile(try fs.path.join(allocator, &.{ "os_test_tmp", "b", "file2.txt" }), "blah"); |
| 923 | | 920 | |
| 924 | try ctx.dir.deleteTreeMinStackSize(dir_path); | 921 | try ctx.dir.deleteTreeMinStackSize(dir_path); |
| 925 | try testing.expectError(error.FileNotFound, ctx.dir.openDir(dir_path, .{})); | 922 | try testing.expectError(error.FileNotFound, ctx.dir.openDir(dir_path, .{})); |
| ... | @@ -1204,6 +1201,7 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void { | ... | @@ -1204,6 +1201,7 @@ fn expectFileContents(dir: Dir, file_path: []const u8, data: []const u8) !void { |
| 1204 | test "AtomicFile" { | 1201 | test "AtomicFile" { |
| 1205 | try testWithAllSupportedPathTypes(struct { | 1202 | try testWithAllSupportedPathTypes(struct { |
| 1206 | fn impl(ctx: *TestContext) !void { | 1203 | fn impl(ctx: *TestContext) !void { |
| | 1204 | const allocator = ctx.arena.allocator(); |
| 1207 | const test_out_file = try ctx.transformPath("tmp_atomic_file_test_dest.txt"); | 1205 | const test_out_file = try ctx.transformPath("tmp_atomic_file_test_dest.txt"); |
| 1208 | const test_content = | 1206 | const test_content = |
| 1209 | \\ hello! | 1207 | \\ hello! |
| ... | @@ -1216,8 +1214,7 @@ test "AtomicFile" { | ... | @@ -1216,8 +1214,7 @@ test "AtomicFile" { |
| 1216 | try af.file.writeAll(test_content); | 1214 | try af.file.writeAll(test_content); |
| 1217 | try af.finish(); | 1215 | try af.finish(); |
| 1218 | } | 1216 | } |
| 1219 | const content = try ctx.dir.readFileAlloc(testing.allocator, test_out_file, 9999); | 1217 | const content = try ctx.dir.readFileAlloc(allocator, test_out_file, 9999); |
| 1220 | defer testing.allocator.free(content); | | |
| 1221 | try testing.expectEqualStrings(test_content, content); | 1218 | try testing.expectEqualStrings(test_content, content); |
| 1222 | | 1219 | |
| 1223 | try ctx.dir.deleteFile(test_out_file); | 1220 | try ctx.dir.deleteFile(test_out_file); |
| ... | @@ -1337,7 +1334,7 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { | ... | @@ -1337,7 +1334,7 @@ test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 1337 | const cwd = try std.process.getCwdAlloc(gpa); | 1334 | const cwd = try std.process.getCwdAlloc(gpa); |
| 1338 | defer gpa.free(cwd); | 1335 | defer gpa.free(cwd); |
| 1339 | | 1336 | |
| 1340 | const filename = try fs.path.resolve(gpa, &[_][]const u8{ cwd, sub_path }); | 1337 | const filename = try fs.path.resolve(gpa, &.{ cwd, sub_path }); |
| 1341 | defer gpa.free(filename); | 1338 | defer gpa.free(filename); |
| 1342 | | 1339 | |
| 1343 | const file1 = try fs.createFileAbsolute(filename, .{ | 1340 | const file1 = try fs.createFileAbsolute(filename, .{ |
| ... | @@ -1477,30 +1474,30 @@ test ". and .. in absolute functions" { | ... | @@ -1477,30 +1474,30 @@ test ". and .. in absolute functions" { |
| 1477 | const allocator = arena.allocator(); | 1474 | const allocator = arena.allocator(); |
| 1478 | | 1475 | |
| 1479 | const base_path = blk: { | 1476 | const base_path = blk: { |
| 1480 | const relative_path = try fs.path.join(allocator, &[_][]const u8{ "zig-cache", "tmp", tmp.sub_path[0..] }); | 1477 | const relative_path = try fs.path.join(allocator, &.{ "zig-cache", "tmp", tmp.sub_path[0..] }); |
| 1481 | break :blk try fs.realpathAlloc(allocator, relative_path); | 1478 | break :blk try fs.realpathAlloc(allocator, relative_path); |
| 1482 | }; | 1479 | }; |
| 1483 | | 1480 | |
| 1484 | const subdir_path = try fs.path.join(allocator, &[_][]const u8{ base_path, "./subdir" }); | 1481 | const subdir_path = try fs.path.join(allocator, &.{ base_path, "./subdir" }); |
| 1485 | try fs.makeDirAbsolute(subdir_path); | 1482 | try fs.makeDirAbsolute(subdir_path); |
| 1486 | try fs.accessAbsolute(subdir_path, .{}); | 1483 | try fs.accessAbsolute(subdir_path, .{}); |
| 1487 | var created_subdir = try fs.openDirAbsolute(subdir_path, .{}); | 1484 | var created_subdir = try fs.openDirAbsolute(subdir_path, .{}); |
| 1488 | created_subdir.close(); | 1485 | created_subdir.close(); |
| 1489 | | 1486 | |
| 1490 | const created_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../file" }); | 1487 | const created_file_path = try fs.path.join(allocator, &.{ subdir_path, "../file" }); |
| 1491 | const created_file = try fs.createFileAbsolute(created_file_path, .{}); | 1488 | const created_file = try fs.createFileAbsolute(created_file_path, .{}); |
| 1492 | created_file.close(); | 1489 | created_file.close(); |
| 1493 | try fs.accessAbsolute(created_file_path, .{}); | 1490 | try fs.accessAbsolute(created_file_path, .{}); |
| 1494 | | 1491 | |
| 1495 | const copied_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../copy" }); | 1492 | const copied_file_path = try fs.path.join(allocator, &.{ subdir_path, "../copy" }); |
| 1496 | try fs.copyFileAbsolute(created_file_path, copied_file_path, .{}); | 1493 | try fs.copyFileAbsolute(created_file_path, copied_file_path, .{}); |
| 1497 | const renamed_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../rename" }); | 1494 | const renamed_file_path = try fs.path.join(allocator, &.{ subdir_path, "../rename" }); |
| 1498 | try fs.renameAbsolute(copied_file_path, renamed_file_path); | 1495 | try fs.renameAbsolute(copied_file_path, renamed_file_path); |
| 1499 | const renamed_file = try fs.openFileAbsolute(renamed_file_path, .{}); | 1496 | const renamed_file = try fs.openFileAbsolute(renamed_file_path, .{}); |
| 1500 | renamed_file.close(); | 1497 | renamed_file.close(); |
| 1501 | try fs.deleteFileAbsolute(renamed_file_path); | 1498 | try fs.deleteFileAbsolute(renamed_file_path); |
| 1502 | | 1499 | |
| 1503 | const update_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../update" }); | 1500 | const update_file_path = try fs.path.join(allocator, &.{ subdir_path, "../update" }); |
| 1504 | const update_file = try fs.createFileAbsolute(update_file_path, .{}); | 1501 | const update_file = try fs.createFileAbsolute(update_file_path, .{}); |
| 1505 | try update_file.writeAll("something"); | 1502 | try update_file.writeAll("something"); |
| 1506 | update_file.close(); | 1503 | update_file.close(); |