We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
error.PathAlreadyExists
renameTmpIntoCache
1 parent dd076d8 commit 1cdc51eCopy full SHA for 1cdc51e
src/link.zig
@@ -672,12 +672,21 @@ pub const File = struct {
672
// is not needed we can refactor this into having the frontend do the rename
673
// directly, and remove this function from link.zig.
674
_ = base;
675
- try std.fs.rename(
676
- cache_directory.handle,
677
- tmp_dir_sub_path,
678
679
- o_sub_path,
680
- );
+ while (true) {
+ std.fs.rename(
+ cache_directory.handle,
+ tmp_dir_sub_path,
+ 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
+ }
690
}
691
692
pub fn linkAsArchive(base: *File, comp: *Compilation) !void {
0 commit comments