| ... | @@ -672,12 +672,21 @@ pub const File = struct { | ... | @@ -672,12 +672,21 @@ pub const File = struct { |
| 672 | // is not needed we can refactor this into having the frontend do the rename | 672 | // is not needed we can refactor this into having the frontend do the rename |
| 673 | // directly, and remove this function from link.zig. | 673 | // directly, and remove this function from link.zig. |
| 674 | _ = base; | 674 | _ = base; |
| 675 | try std.fs.rename( | 675 | while (true) { |
| 676 | cache_directory.handle, | 676 | std.fs.rename( |
| 677 | tmp_dir_sub_path, | 677 | cache_directory.handle, |
| 678 | cache_directory.handle, | 678 | tmp_dir_sub_path, |
| 679 | o_sub_path, | 679 | cache_directory.handle, |
| 680 | ); | 680 | o_sub_path, |
| | 681 | ) catch |err| switch (err) { |
| | 682 | error.PathAlreadyExists => { |
| | 683 | try cache_directory.handle.deleteTree(o_sub_path); |
| | 684 | continue; |
| | 685 | }, |
| | 686 | else => |e| return e, |
| | 687 | }; |
| | 688 | break; |
| | 689 | } |
| 681 | } | 690 | } |
| 682 | | 691 | |
| 683 | pub fn linkAsArchive(base: *File, comp: *Compilation) !void { | 692 | pub fn linkAsArchive(base: *File, comp: *Compilation) !void { |