mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
parent
eb65410b62
commit
72899da44b
@ -1136,13 +1136,14 @@ pub fn copyFile(source_path: []const u8, dest_path: []const u8) !void {
|
||||
defer in_file.close();
|
||||
|
||||
const mode = try in_file.mode();
|
||||
const in_stream = &in_file.inStream().stream;
|
||||
|
||||
var atomic_file = try AtomicFile.init(dest_path, mode);
|
||||
defer atomic_file.deinit();
|
||||
|
||||
var buf: [page_size]u8 = undefined;
|
||||
while (true) {
|
||||
const amt = try in_file.readFull(buf[0..]);
|
||||
const amt = try in_stream.readFull(buf[0..]);
|
||||
try atomic_file.file.write(buf[0..amt]);
|
||||
if (amt != buf.len) {
|
||||
return atomic_file.finish();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user