Qt: Fix manual redump database downloading/updating

This commit is contained in:
Connor McLaughlin
2020-11-28 00:42:09 +10:00
parent a75b6e512a
commit 16a6c1706e
4 changed files with 21 additions and 5 deletions

View File

@ -737,6 +737,22 @@ void GameList::LoadDatabase()
m_database_load_tried = true;
tinyxml2::XMLDocument doc;
if (FileSystem::FileExists(m_user_database_filename.c_str()))
{
std::unique_ptr<ByteStream> stream =
FileSystem::OpenFile(m_user_database_filename.c_str(), BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);
if (stream)
{
const std::string xml(FileSystem::ReadStreamToString(stream.get()));
tinyxml2::XMLError error = doc.Parse(xml.data(), xml.size());
if (error != tinyxml2::XML_SUCCESS)
{
Log_ErrorPrintf("Failed to parse redump dat: %s", tinyxml2::XMLDocument::ErrorIDToName(error));
doc.Clear();
}
}
}
if (!doc.RootElement())
{
std::unique_ptr<ByteStream> stream = g_host_interface->OpenPackageFile(
"database" FS_OSPATH_SEPARATOR_STR "redump.dat", BYTESTREAM_OPEN_READ | BYTESTREAM_OPEN_STREAMED);