aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-11-26 20:21:53 +0100
committerJakub Konka <kubkon@jakubkonka.com>2020-11-26 20:21:53 +0100
commita8f8d8221595a422b61ceca8835c677f6830799d (patch)
treefab3e8d1fe904a98558fbb92cb6e0251d3c8590b /src/link.zig
parentf125c4f5c795485e3c927c85198828793c1be434 (diff)
downloadzig-a8f8d8221595a422b61ceca8835c677f6830799d.tar.gz
zig-a8f8d8221595a422b61ceca8835c677f6830799d.zip
stage2 macho: use Dir.copyFile instead of manual create+copy
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/link.zig b/src/link.zig
index 2b53942ff7..98082570b7 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -263,10 +263,7 @@ pub const File = struct {
fs.base64_encoder.encode(&random_sub_path, &random_bytes);
const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });
defer base.allocator.free(tmp_file_name);
- var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });
- defer tmp_file.close();
- const stat = try f.stat();
- _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
+ try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, tmp_file_name, .{});
try emit.directory.handle.rename(tmp_file_name, emit.sub_path);
}
f.close();