mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
GameList: Fix cover search from game serial/code
This commit is contained in:
parent
4274bc1daf
commit
41f36d0673
|
@ -1118,16 +1118,22 @@ std::string GameList::GetCoverImagePathForEntry(const GameListEntry* entry)
|
||||||
for (const char* extension : extensions)
|
for (const char* extension : extensions)
|
||||||
{
|
{
|
||||||
// try the title
|
// try the title
|
||||||
cover_path.Format("%s" FS_OSPATH_SEPARATOR_STR "covers" FS_OSPATH_SEPARATOR_STR "%s.%s",
|
if (!entry->title.empty())
|
||||||
g_host_interface->GetUserDirectory().c_str(), entry->title.c_str(), extension);
|
{
|
||||||
if (FileSystem::FileExists(cover_path))
|
cover_path.Format("%s" FS_OSPATH_SEPARATOR_STR "covers" FS_OSPATH_SEPARATOR_STR "%s.%s",
|
||||||
return std::string(cover_path.GetCharArray());
|
g_host_interface->GetUserDirectory().c_str(), entry->title.c_str(), extension);
|
||||||
|
if (FileSystem::FileExists(cover_path))
|
||||||
|
return std::string(cover_path.GetCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
// then the code
|
// then the code
|
||||||
cover_path.Format("%s" FS_OSPATH_SEPARATOR_STR "covers" FS_OSPATH_SEPARATOR_STR "%s.%s",
|
if (!entry->code.empty())
|
||||||
g_host_interface->GetUserDirectory().c_str(), entry->title.c_str(), extension);
|
{
|
||||||
if (FileSystem::FileExists(cover_path))
|
cover_path.Format("%s" FS_OSPATH_SEPARATOR_STR "covers" FS_OSPATH_SEPARATOR_STR "%s.%s",
|
||||||
return std::string(cover_path.GetCharArray());
|
g_host_interface->GetUserDirectory().c_str(), entry->code.c_str(), extension);
|
||||||
|
if (FileSystem::FileExists(cover_path))
|
||||||
|
return std::string(cover_path.GetCharArray());
|
||||||
|
}
|
||||||
|
|
||||||
// and the file title if it differs
|
// and the file title if it differs
|
||||||
const std::string_view file_title = GetFileNameFromPath(entry->path.c_str());
|
const std::string_view file_title = GetFileNameFromPath(entry->path.c_str());
|
||||||
|
|
Loading…
Reference in a new issue