mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 08:33:15 +00:00
handle error.PathAlreadyExists in renameTmpIntoCache
This commit is contained in:
parent
dd076d8cba
commit
1cdc51ec10
21
src/link.zig
21
src/link.zig
@ -672,12 +672,21 @@ pub const File = struct {
|
||||
// is not needed we can refactor this into having the frontend do the rename
|
||||
// directly, and remove this function from link.zig.
|
||||
_ = base;
|
||||
try std.fs.rename(
|
||||
cache_directory.handle,
|
||||
tmp_dir_sub_path,
|
||||
cache_directory.handle,
|
||||
o_sub_path,
|
||||
);
|
||||
while (true) {
|
||||
std.fs.rename(
|
||||
cache_directory.handle,
|
||||
tmp_dir_sub_path,
|
||||
cache_directory.handle,
|
||||
o_sub_path,
|
||||
) catch |err| switch (err) {
|
||||
error.PathAlreadyExists => {
|
||||
try cache_directory.handle.deleteTree(o_sub_path);
|
||||
continue;
|
||||
},
|
||||
else => |e| return e,
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn linkAsArchive(base: *File, comp: *Compilation) !void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user