| ... | ... | @@ -1149,22 +1149,22 @@ pub fn makePath(allocator: *Allocator, full_path: []const u8) !void { |
| 1149 | 1149 | |
| 1150 | 1150 | var end_index: usize = resolved_path.len; |
| 1151 | 1151 | while (true) { |
| 1152 | | makeDir(allocator, resolved_path[0..end_index]) catch |err| { |
| 1153 | | if (err == error.PathAlreadyExists) { |
| 1152 | makeDir(allocator, resolved_path[0..end_index]) catch |err| switch (err) { |
| 1153 | error.PathAlreadyExists => { |
| 1154 | 1154 | // TODO stat the file and return an error if it's not a directory |
| 1155 | 1155 | // this is important because otherwise a dangling symlink |
| 1156 | 1156 | // could cause an infinite loop |
| 1157 | 1157 | if (end_index == resolved_path.len) return; |
| 1158 | | } else if (err == error.FileNotFound) { |
| 1158 | }, |
| 1159 | error.FileNotFound => { |
| 1159 | 1160 | // march end_index backward until next path component |
| 1160 | 1161 | while (true) { |
| 1161 | 1162 | end_index -= 1; |
| 1162 | 1163 | if (os.path.isSep(resolved_path[end_index])) break; |
| 1163 | 1164 | } |
| 1164 | 1165 | continue; |
| 1165 | | } else { |
| 1166 | | return err; |
| 1167 | | } |
| 1166 | }, |
| 1167 | else => return err, |
| 1168 | 1168 | }; |
| 1169 | 1169 | if (end_index == resolved_path.len) return; |
| 1170 | 1170 | // march end_index forward until next path component |