MCPcopy Create free account
hub / github.com/ImageEngine/cortex / ~StreamFile

Method ~StreamFile

src/IECore/FileIndexedIO.cpp:155–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155FileIndexedIO::StreamFile::~StreamFile()
156{
157 if ( m_openmode == IndexedIO::Write || m_openmode == IndexedIO::Append )
158 {
159 std::fstream *f = static_cast< std::fstream * >( m_stream );
160
161 f->seekg( 0, std::ios::end );
162 uint64_t fileEnd = f->tellg();
163
164 // .. and the length of that file extends beyond the end of the index
165 if ( fileEnd > m_endPosition )
166 {
167 /// Close the file before truncation
168 delete m_stream;
169 m_stream = nullptr;
170
171 /// Truncate the file at the end of the index
172 fs::resize_file( m_filename, m_endPosition );
173 }
174 }
175}
176
177bool FileIndexedIO::StreamFile::canRead( const std::string &path )
178{

Callers

nothing calls this directly

Calls 2

seekgMethod · 0.80
tellgMethod · 0.80

Tested by

no test coverage detected