Fix #131175: corrupted data when unpacking bake on windows

The issue was that on windows any `\n` byte would be written as
`\r\n` which corrupts the data, unless `std::ios::binary` is provided.
This commit is contained in:
Jacques Lucke
2024-12-12 12:08:37 +01:00
parent 7e1db7de19
commit c22ade6993

View File

@@ -85,7 +85,7 @@ bool unpack_bake_to_disk(const NodesModifierPackedBake &packed_bake,
BKE_reportf(reports, RPT_ERROR, "Cannot ensure directory: %s", directory.c_str());
return false;
}
fstream fs(file_path, std::ios::out);
fstream fs(file_path, std::ios::out | std::ios::binary);
fs.write(static_cast<const char *>(bake_file.packed_file->data), bake_file.packed_file->size);
if (fs.bad()) {
BKE_reportf(reports, RPT_ERROR, "Cannot write file: %s", file_path);