| ... | ... | @@ -186,28 +186,6 @@ pub fn last(in: [][]const u8) ![]const u8 { |
| 186 | 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 | 189 | const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz"; |
| 212 | 190 | |
| 213 | 191 | pub fn random_string(len: usize) ![]const u8 { |