| ... | @@ -263,10 +263,7 @@ pub const File = struct { | ... | @@ -263,10 +263,7 @@ pub const File = struct { |
| 263 | fs.base64_encoder.encode(&random_sub_path, &random_bytes); | 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..] }); | 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); | 265 | defer base.allocator.free(tmp_file_name); |
| 266 | var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) }); | 266 | try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, tmp_file_name, .{}); |
| 267 | defer tmp_file.close(); | | |
| 268 | const stat = try f.stat(); | | |
| 269 | _ = try f.copyRangeAll(0, tmp_file, 0, stat.size); | | |
| 270 | try emit.directory.handle.rename(tmp_file_name, emit.sub_path); | 267 | try emit.directory.handle.rename(tmp_file_name, emit.sub_path); |
| 271 | } | 268 | } |
| 272 | f.close(); | 269 | f.close(); |