Add flush method to SweepstoreFileHandle for improved data synchronization

This commit is contained in:
ImBenji
2025-12-02 15:24:01 +00:00
parent 5d9b34e030
commit 82efc4a524
3 changed files with 21 additions and 3 deletions

View File

@@ -55,6 +55,23 @@ void SweepstoreFileHandle::close() {
#endif
}
// flush
void SweepstoreFileHandle::flush() {
#ifdef WITH_UNREAL
if (unrealHandle) {
unrealHandle->Flush();
}
#else
if (stream) {
stream->flush();
#ifdef _WIN32
// On Windows, also sync to ensure data hits disk
stream->sync();
#endif
}
#endif
}
#if defined(_WIN32) || defined(WITH_UNREAL)
// readSeek
void SweepstoreFileHandle::readSeek(std::streampos pos, std::ios::seekdir dir) {