Compare commits
No commits in common. "a0fa079a1376396f193dd9bb85e94957bc9f53f6" and "b556c1da61d4ef0df07de9e2338c3594a70235a9" have entirely different histories.
a0fa079a13
...
b556c1da61
1 changed files with 14 additions and 4 deletions
|
|
@ -933,10 +933,10 @@ const Node = union(enum) {
|
||||||
try node.right.store(writer, eol_mode);
|
try node.right.store(writer, eol_mode);
|
||||||
},
|
},
|
||||||
.leaf => |*leaf| {
|
.leaf => |*leaf| {
|
||||||
try writer.writeAll(leaf.buf);
|
_ = try writer.write(leaf.buf);
|
||||||
if (leaf.eol) switch (eol_mode) {
|
if (leaf.eol) switch (eol_mode) {
|
||||||
.lf => try writer.writeByte('\n'),
|
.lf => _ = try writer.write("\n"),
|
||||||
.crlf => try writer.writeAll("\r\n"),
|
.crlf => _ = try writer.write("\r\n"),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -1374,7 +1374,17 @@ pub fn store_to_string(self: *const Self, allocator: Allocator, eol_mode: EolMod
|
||||||
}
|
}
|
||||||
|
|
||||||
fn store_to_file_const(self: *const Self, writer: *std.Io.Writer) StoreToFileError!void {
|
fn store_to_file_const(self: *const Self, writer: *std.Io.Writer) StoreToFileError!void {
|
||||||
try self.root.store(writer, self.file_eol_mode);
|
switch (builtin.os.tag) {
|
||||||
|
.linux => {
|
||||||
|
try self.root.store(writer, self.file_eol_mode);
|
||||||
|
},
|
||||||
|
else => {
|
||||||
|
var content: std.Io.Writer.Allocating = .init(self.external_allocator);
|
||||||
|
defer content.deinit();
|
||||||
|
try self.root.store(&content.writer, self.file_eol_mode);
|
||||||
|
try writer.writeAll(content.written());
|
||||||
|
},
|
||||||
|
}
|
||||||
try writer.flush();
|
try writer.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue