authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-05-06 03:06:45 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-05-06 03:06:45 -07:00
log34a35bbf09436dc3036f66acf49d7180dd8b1215
tree63fd0bd301fc386d9300e73556dd922dc3cf04f9
parent579e961999dc77531c04deecbe099445de94ce4f

util: remove u.mkdir_all, closes #11


3 files changed, 2 insertions(+), 16 deletions(-)

src/common.zig+1-1
...@@ -102,7 +102,7 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, comptime o...@@ -102,7 +102,7 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, comptime o
102 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{ d.path, @tagName(vers.id), vers.string });102 u.assert(false, "fetch: git: {s}: {s} {s} does not exist", .{ d.path, @tagName(vers.id), vers.string });
103 }103 }
104 const td_fd = try fs.cwd().openDir(basedir, .{});104 const td_fd = try fs.cwd().openDir(basedir, .{});
105 try u.mkdir_all(pv);105 try fs.cwd().makePath(pv);
106 try td_fd.rename("temp", try d.clean_path_v());106 try td_fd.rename("temp", try d.clean_path_v());
107 if (vers.id != .branch) {107 if (vers.id != .branch) {
108 const pvd = try std.fs.cwd().openDir(pv, .{});108 const pvd = try std.fs.cwd().openDir(pv, .{});
src/util/dep_type.zig+1-1
...@@ -40,7 +40,7 @@ pub const DepType = enum {...@@ -40,7 +40,7 @@ pub const DepType = enum {
40 _ = try u.run_cmd(null, &.{ "hg", "clone", rpath, dpath });40 _ = try u.run_cmd(null, &.{ "hg", "clone", rpath, dpath });
41 },41 },
42 .http => {42 .http => {
43 try u.mkdir_all(dpath);43 try std.fs.cwd().makePath(dpath);
44 _ = try u.run_cmd(dpath, &.{ "wget", rpath });44 _ = try u.run_cmd(dpath, &.{ "wget", rpath });
45 const f = rpath[std.mem.lastIndexOf(u8, rpath, "/").? + 1 ..];45 const f = rpath[std.mem.lastIndexOf(u8, rpath, "/").? + 1 ..];
46 if (std.mem.endsWith(u8, f, ".zip")) {46 if (std.mem.endsWith(u8, f, ".zip")) {
src/util/funcs.zig-14
...@@ -186,20 +186,6 @@ pub fn last(in: [][]const u8) ![]const u8 {...@@ -186,20 +186,6 @@ pub fn last(in: [][]const u8) ![]const u8 {
186 return in[in.len - 1];186 return in[in.len - 1];
187}187}
188188
189pub fn mkdir_all(dpath: []const u8) anyerror!void {
190 if (dpath.len == 0) {
191 return;
192 }
193 const d = if (dpath[dpath.len - 1] == std.fs.path.sep) dpath[0 .. dpath.len - 1] else dpath;
194 const ps = std.fs.path.sep_str;
195 if (std.mem.lastIndexOf(u8, d, ps)) |index| {
196 try mkdir_all(d[0..index]);
197 }
198 if (!try does_folder_exist(d)) {
199 try std.fs.cwd().makeDir(d);
200 }
201}
202
203pub fn rm_recv(path: []const u8) anyerror!void {189pub fn rm_recv(path: []const u8) anyerror!void {
204 const abs_path = std.fs.realpathAlloc(gpa, path) catch |e| switch (e) {190 const abs_path = std.fs.realpathAlloc(gpa, path) catch |e| switch (e) {
205 error.FileNotFound => return,191 error.FileNotFound => return,