HDF5: Destructor of HDF5DataFile doesn't copy file, it actually removes it
This commit is contained in:
@@ -75,8 +75,10 @@ std::optional<HDF5DataFileStatistics> HDF5DataFile::Close() {
|
||||
data_set
|
||||
->Attr("image_nr_low", (int32_t) (image_low + 1))
|
||||
.Attr("image_nr_high", (int32_t) (image_low + 1 + max_image_number));
|
||||
data_set->Close();
|
||||
data_set.reset();
|
||||
}
|
||||
data_file->Close();
|
||||
data_file.reset();
|
||||
|
||||
if (manage_file && (!std::filesystem::exists(filename.c_str()) || overwrite))
|
||||
@@ -89,13 +91,17 @@ std::optional<HDF5DataFileStatistics> HDF5DataFile::Close() {
|
||||
ret.total_images = nimages;
|
||||
ret.filename = filename;
|
||||
ret.file_number = file_number + 1;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
HDF5DataFile::~HDF5DataFile() {
|
||||
if (data_file) {
|
||||
try {
|
||||
Close();
|
||||
data_set->Close();
|
||||
data_file->Close();
|
||||
std::filesystem::remove(tmp_filename);
|
||||
} catch (const std::exception &e) {
|
||||
std::cerr << "HDF5DataFile::~HDF5DataFile: " << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
|
||||
Reference in New Issue
Block a user