MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / close

Method close

Tactility/Source/file/ObjectFileWriter.cpp:82–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void ObjectFileWriter::close() {
83 if (file == nullptr) {
84 LOGGER.error("File not opened: {}", filePath);
85 return;
86 }
87
88 if (fseek(file.get(), sizeof(FileHeader), SEEK_SET) != 0) {
89 LOGGER.error("File seek failed: {}", filePath);
90 return;
91 }
92
93 ContentHeader content_header = {
94 .recordVersion = this->recordVersion,
95 .recordSize = this->recordSize,
96 .recordCount = this->recordsWritten
97 };
98
99 if (fwrite(&content_header, sizeof(ContentHeader), 1, file.get()) != 1) {
100 LOGGER.error("Failed to write content header to {}", filePath);
101 }
102
103 file = nullptr;
104}
105
106bool ObjectFileWriter::write(void* data) {
107 if (file == nullptr) {

Callers

nothing calls this directly

Calls 2

errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected