| ... | ... | @@ -186,13 +186,14 @@ pub fn last(in: [][]const u8) ![]const u8 { |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | pub fn mkdir_all(dpath: []const u8) anyerror!void { |
| 189 | if (dpath.len == 0) { |
| 190 | return; |
| 191 | } |
| 189 | 192 | const d = if (dpath[dpath.len-1] == std.fs.path.sep) dpath[0..dpath.len-1] else dpath; |
| 190 | 193 | const ps = std.fs.path.sep_str; |
| 191 | | const e = dpath[0..std.mem.lastIndexOf(u8, dpath, ps).?]; |
| 192 | | if (std.mem.indexOf(u8, e, ps)) |_| {} else { |
| 193 | | return; |
| 194 | if (std.mem.lastIndexOf(u8, d, ps)) |index| { |
| 195 | try mkdir_all(d[0..index]); |
| 194 | 196 | } |
| 195 | | try mkdir_all(e); |
| 196 | 197 | if (!try does_folder_exist(d)) { |
| 197 | 198 | try std.fs.cwd().makeDir(d); |
| 198 | 199 | } |