mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 04:29:38 +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)
|
, 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() {
|
bool GltfSerializer::ready() {
|
||||||
return fstream_.is_open() && tmp_fstream1_.is_open() && tmp_fstream2_.is_open();
|
return fstream_.is_open() && tmp_fstream1_.is_open() && tmp_fstream2_.is_open();
|
||||||
}
|
}
|
||||||
@@ -323,9 +330,6 @@ void GltfSerializer::finalize() {
|
|||||||
fstream_ << ifs.rdbuf();
|
fstream_ << ifs.rdbuf();
|
||||||
}
|
}
|
||||||
write_padding<BIN>(fstream_, binary_length);
|
write_padding<BIN>(fstream_, binary_length);
|
||||||
|
|
||||||
IfcUtil::path::delete_file(tmp_filename1_);
|
|
||||||
IfcUtil::path::delete_file(tmp_filename2_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
int writeMaterial(const IfcGeom::Material& style);
|
int writeMaterial(const IfcGeom::Material& style);
|
||||||
public:
|
public:
|
||||||
GltfSerializer(const std::string& filename, const SerializerSettings& settings);
|
GltfSerializer(const std::string& filename, const SerializerSettings& settings);
|
||||||
virtual ~GltfSerializer() {}
|
virtual ~GltfSerializer();
|
||||||
bool ready();
|
bool ready();
|
||||||
void writeHeader();
|
void writeHeader();
|
||||||
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
void write(const IfcGeom::TriangulationElement<real_t>* o);
|
||||||
|
|||||||
Reference in New Issue
Block a user