| ... | ... | @@ -254,17 +254,8 @@ pub const File = struct { |
| 254 | 254 | // into a new inode, remove the original file, and rename the copy to match |
| 255 | 255 | // the original file. This is super messy, but there doesn't seem any other |
| 256 | 256 | // way to please the XNU. |
| 257 | | const random_bytes_len = 12; |
| 258 | | comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len); |
| 259 | 257 | const emit = base.options.emit orelse return; |
| 260 | | var random_bytes: [random_bytes_len]u8 = undefined; |
| 261 | | try std.crypto.randomBytes(&random_bytes); |
| 262 | | var random_sub_path: [random_sub_path_len]u8 = undefined; |
| 263 | | fs.base64_encoder.encode(&random_sub_path, &random_bytes); |
| 264 | | const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] }); |
| 265 | | defer base.allocator.free(tmp_file_name); |
| 266 | | try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, tmp_file_name, .{}); |
| 267 | | try emit.directory.handle.rename(tmp_file_name, emit.sub_path); |
| 258 | try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, emit.sub_path, .{}); |
| 268 | 259 | } |
| 269 | 260 | f.close(); |
| 270 | 261 | base.file = null; |