fix: add workaround for Buffer.store_to_file_const bug on non-linux platforms

This commit is contained in:
CJ van den Berg 2025-10-30 16:54:10 +01:00
parent d201a84ec8
commit b556c1da61
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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 {
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();
}