| author | |
| committer | |
| log | cdbcca208bb393e6e92247272c402f7df46fb737 |
| tree | 862e53e9dcd86f072e14df16930fdb20ad8a0016 |
| parent | 34a35bbf09436dc3036f66acf49d7180dd8b1215 |
2 files changed, 2 insertions(+), 24 deletions(-)
src/common.zig+2-2| ... | @@ -144,12 +144,12 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, comptime o | ... | @@ -144,12 +144,12 @@ fn get_moddir(basedir: []const u8, d: u.Dep, parent_name: []const u8, comptime o |
| 144 | try std.fs.cwd().deleteFile(file_path); | 144 | try std.fs.cwd().deleteFile(file_path); |
| 145 | return pv; | 145 | return pv; |
| 146 | } | 146 | } |
| 147 | try u.rm_recv(pv); | 147 | try std.fs.cwd().deleteTree(pv); |
| 148 | u.assert(false, "{s} does not match hash {s}", .{ d.path, d.version }); | 148 | u.assert(false, "{s} does not match hash {s}", .{ d.path, d.version }); |
| 149 | return p; | 149 | return p; |
| 150 | } | 150 | } |
| 151 | if (try u.does_folder_exist(p)) { | 151 | if (try u.does_folder_exist(p)) { |
| 152 | try u.rm_recv(p); | 152 | try std.fs.cwd().deleteTree(p); |
| 153 | } | 153 | } |
| 154 | const file_path = try std.fs.path.join(gpa, &.{ p, file_name }); | 154 | const file_path = try std.fs.path.join(gpa, &.{ p, file_name }); |
| 155 | try d.type.pull(d.path, p); | 155 | try d.type.pull(d.path, p); |
src/util/funcs.zig-22| ... | @@ -186,28 +186,6 @@ pub fn last(in: [][]const u8) ![]const u8 { | ... | @@ -186,28 +186,6 @@ pub fn last(in: [][]const u8) ![]const u8 { |
| 186 | return in[in.len - 1]; | 186 | return in[in.len - 1]; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | pub fn rm_recv(path: []const u8) anyerror!void { | ||
| 190 | const abs_path = std.fs.realpathAlloc(gpa, path) catch |e| switch (e) { | ||
| 191 | error.FileNotFound => return, | ||
| 192 | else => return e, | ||
| 193 | }; | ||
| 194 | const file = try std.fs.openFileAbsolute(abs_path, .{}); | ||
| 195 | defer file.close(); | ||
| 196 | const s = try file.stat(); | ||
| 197 | if (s.kind == .Directory) { | ||
| 198 | const dir = std.fs.cwd().openDir(abs_path, .{ | ||
| 199 | .iterate = true, | ||
| 200 | }) catch unreachable; | ||
| 201 | var iter = dir.iterate(); | ||
| 202 | while (try iter.next()) |item| { | ||
| 203 | try rm_recv(try std.fs.path.join(gpa, &.{ abs_path, item.name })); | ||
| 204 | } | ||
| 205 | try std.fs.deleteDirAbsolute(abs_path); | ||
| 206 | } else { | ||
| 207 | try std.fs.deleteFileAbsolute(abs_path); | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; | 189 | const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; |
| 212 | 190 | ||
| 213 | pub fn random_string(len: usize) ![]const u8 { | 191 | pub fn random_string(len: usize) ![]const u8 { |