mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Clean up glb tempfiles in case of error
This commit is contained in:
@@ -54,6 +54,13 @@ GltfSerializer::GltfSerializer(const std::string& filename, const SerializerSett
|
||||
, tmp_fstream2_(IfcUtil::path::from_utf8(tmp_filename2_).c_str(), std::ios_base::binary)
|
||||
{}
|
||||
|
||||
GltfSerializer::~GltfSerializer() {
|
||||
tmp_fstream1_.close();
|
||||
tmp_fstream2_.close();
|
||||
IfcUtil::path::delete_file(tmp_filename1_);
|
||||
IfcUtil::path::delete_file(tmp_filename2_);
|
||||
}
|
||||
|
||||
bool GltfSerializer::ready() {
|
||||
return fstream_.is_open() && tmp_fstream1_.is_open() && tmp_fstream2_.is_open();
|
||||
}
|
||||
@@ -323,9 +330,6 @@ void GltfSerializer::finalize() {
|
||||
fstream_ << ifs.rdbuf();
|
||||
}
|
||||
write_padding<BIN>(fstream_, binary_length);
|
||||
|
||||
IfcUtil::path::delete_file(tmp_filename1_);
|
||||
IfcUtil::path::delete_file(tmp_filename2_);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
int writeMaterial(const IfcGeom::Material& style);
|
||||
public:
|
||||
GltfSerializer(const std::string& filename, const SerializerSettings& settings);
|
||||
virtual ~GltfSerializer() {}
|
||||
virtual ~GltfSerializer();
|
||||
bool ready();
|
||||
void writeHeader();
|
||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||
|
||||
Reference in New Issue
Block a user