WIP: Exporting 3MFs through a streaming interface.

This commit is contained in:
Vojtech Bubnik 2021-01-26 12:19:35 +01:00
parent 729298c408
commit 55c698feef

View file

@ -2302,9 +2302,12 @@ namespace Slic3r {
stream << "</" << MODEL_TAG << ">\n";
std::string out = stream.str();
mz_zip_writer_staged_context context;
std::string buf = stream.str();
if (!mz_zip_writer_add_mem(&archive, MODEL_FILE.c_str(), (const void*)out.data(), out.length(), MZ_DEFAULT_COMPRESSION))
if (!mz_zip_writer_add_staged_open(&archive, &context, MODEL_FILE.c_str(), buf.size(), nullptr, nullptr, 0, MZ_DEFAULT_COMPRESSION, nullptr, 0, nullptr, 0) ||
!mz_zip_writer_add_staged_data(&archive, &context, buf.data(), buf.size()) ||
!mz_zip_writer_add_staged_finish(&archive, &context))
{
add_error("Unable to add model file to archive");
return false;