GameList: Flush game list after re-scanning

Should hopefully fix random gamelist corruption.
This commit is contained in:
Connor McLaughlin 2020-04-25 15:23:36 +10:00
parent 25af5ef9d9
commit 194fc63232
2 changed files with 11 additions and 0 deletions

View File

@ -497,6 +497,14 @@ bool GameList::WriteEntryToCache(const GameListEntry* entry, ByteStream* stream)
return result;
}
void GameList::FlushCacheFileStream()
{
if (!m_cache_write_stream)
return;
m_cache_write_stream->Flush();
}
void GameList::CloseCacheFileStream()
{
if (!m_cache_write_stream)
@ -588,6 +596,8 @@ void GameList::ScanDirectory(const char* path, bool recursive, ProgressCallback*
entry = {};
}
FlushCacheFileStream();
progress->SetProgressValue(static_cast<u32>(files.size()));
progress->PopState();
}

View File

@ -107,6 +107,7 @@ private:
bool LoadEntriesFromCache(ByteStream* stream);
bool OpenCacheForWriting();
bool WriteEntryToCache(const GameListEntry* entry, ByteStream* stream);
void FlushCacheFileStream();
void CloseCacheFileStream();
void DeleteCacheFile();