authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-01-16 12:21:00+10:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-03 13:25:43-05:00
log1ca5f06762401d2e90c8119acb4837571696dd5e
tree156e1e5f40abfc798301f35be792463c8bf5b4fe
parent695b0976c3757325d4b2043151d267bcc7490f7e
signature Commit is signed but in an unrecognized format.

Update callers of fs.makePath


6 files changed, 11 insertions(+), 12 deletions(-)

lib/std/build.zig+2-2
......@@ -763,7 +763,7 @@ pub const Builder = struct {
763763 }
764764
765765 pub fn makePath(self: *Builder, path: []const u8) !void {
766 fs.makePath(self.allocator, self.pathFromRoot(path)) catch |err| {
766 fs.cwd().makePath(self.pathFromRoot(path)) catch |err| {
767767 warn("Unable to create path {}: {}\n", .{ path, @errorName(err) });
768768 return err;
769769 };
......@@ -2311,7 +2311,7 @@ pub const InstallDirStep = struct {
23112311 const rel_path = entry.path[full_src_dir.len + 1 ..];
23122312 const dest_path = try fs.path.join(self.builder.allocator, &[_][]const u8{ dest_prefix, rel_path });
23132313 switch (entry.kind) {
2314 .Directory => try fs.makePath(self.builder.allocator, dest_path),
2314 .Directory => try fs.cwd().makePath(dest_path),
23152315 .File => try self.builder.updateFile(entry.path, dest_path),
23162316 else => continue,
23172317 }
lib/std/build/write_file.zig+1-1
......@@ -74,7 +74,7 @@ pub const WriteFileStep = struct {
7474 &hash_basename,
7575 });
7676 // TODO replace with something like fs.makePathAndOpenDir
77 fs.makePath(self.builder.allocator, self.output_dir) catch |err| {
77 fs.cwd().makePath(self.output_dir) catch |err| {
7878 warn("unable to make path {}: {}\n", .{ self.output_dir, @errorName(err) });
7979 return err;
8080 };
lib/std/fs/watch.zig+2-3
......@@ -618,11 +618,10 @@ test "write a file, watch it, write it again" {
618618 // TODO re-enable this test
619619 if (true) return error.SkipZigTest;
620620
621 const allocator = std.heap.page_allocator;
622
623 try os.makePath(allocator, test_tmp_dir);
621 try fs.cwd().makePath(test_tmp_dir);
624622 defer os.deleteTree(test_tmp_dir) catch {};
625623
624 const allocator = std.heap.page_allocator;
626625 return testFsWatch(&allocator);
627626}
628627
lib/std/os/test.zig+2-2
......@@ -16,7 +16,7 @@ const AtomicRmwOp = builtin.AtomicRmwOp;
1616const AtomicOrder = builtin.AtomicOrder;
1717
1818test "makePath, put some files in it, deleteTree" {
19 try fs.makePath(a, "os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c");
19 try fs.cwd().makePath("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c");
2020 try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c" ++ fs.path.sep_str ++ "file.txt", "nonsense");
2121 try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah");
2222 try fs.deleteTree("os_test_tmp");
......@@ -28,7 +28,7 @@ test "makePath, put some files in it, deleteTree" {
2828}
2929
3030test "access file" {
31 try fs.makePath(a, "os_test_tmp");
31 try fs.cwd().makePath("os_test_tmp");
3232 if (fs.cwd().access("os_test_tmp" ++ fs.path.sep_str ++ "file.txt", .{})) |ok| {
3333 @panic("expected error");
3434 } else |err| {
src-self-hosted/compilation.zig+1-1
......@@ -1179,7 +1179,7 @@ pub const Compilation = struct {
11791179 defer self.gpa().free(zig_dir_path);
11801180
11811181 const tmp_dir = try fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] });
1182 try fs.makePath(self.gpa(), tmp_dir);
1182 try fs.cwd().makePath(tmp_dir);
11831183 return tmp_dir;
11841184 }
11851185
src-self-hosted/test.zig+3-3
......@@ -56,7 +56,7 @@ pub const TestContext = struct {
5656 self.zig_lib_dir = try introspect.resolveZigLibDir(allocator);
5757 errdefer allocator.free(self.zig_lib_dir);
5858
59 try std.fs.makePath(allocator, tmp_dir_name);
59 try std.fs.cwd().makePath(tmp_dir_name);
6060 errdefer std.fs.deleteTree(tmp_dir_name) catch {};
6161 }
6262
......@@ -85,7 +85,7 @@ pub const TestContext = struct {
8585 const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
8686
8787 if (std.fs.path.dirname(file1_path)) |dirname| {
88 try std.fs.makePath(allocator, dirname);
88 try std.fs.cwd().makePath(dirname);
8989 }
9090
9191 // TODO async I/O
......@@ -119,7 +119,7 @@ pub const TestContext = struct {
119119
120120 const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", .{ file1_path, (Target{ .Native = {} }).exeFileExt() });
121121 if (std.fs.path.dirname(file1_path)) |dirname| {
122 try std.fs.makePath(allocator, dirname);
122 try std.fs.cwd().makePath(dirname);
123123 }
124124
125125 // TODO async I/O