boxart: delete trailing [.*] in game names. Remove extension first
This commit is contained in:
parent
11ecb473b6
commit
5259aa20e6
|
@ -19,7 +19,7 @@
|
|||
#include "boxart.h"
|
||||
#include "gamesdb.h"
|
||||
|
||||
static std::string getGameFileName(const std::string path)
|
||||
static std::string getGameFileName(const std::string& path)
|
||||
{
|
||||
size_t slash = get_last_slash_pos(path);
|
||||
std::string fileName;
|
||||
|
@ -59,10 +59,14 @@ std::future<const GameBoxart *> Boxart::fetchBoxart(const GameMedia& media)
|
|||
GameBoxart boxart;
|
||||
boxart.fileName = fileName;
|
||||
boxart.gamePath = media.path;
|
||||
boxart.name = trim_trailing_ws(media.gameName);
|
||||
while (boxart.name.back() == ')')
|
||||
boxart.name = trim_trailing_ws(get_file_basename(media.gameName));
|
||||
while (!boxart.name.empty())
|
||||
{
|
||||
size_t pos = boxart.name.find_last_of('(');
|
||||
size_t pos{ std::string::npos };
|
||||
if (boxart.name.back() == ')')
|
||||
pos = boxart.name.find_last_of('(');
|
||||
else if (boxart.name.back() == ']')
|
||||
pos = boxart.name.find_last_of('[');
|
||||
if (pos == std::string::npos)
|
||||
break;
|
||||
boxart.name = trim_trailing_ws(boxart.name.substr(0, pos));
|
||||
|
|
|
@ -36,7 +36,7 @@ bool Scraper::downloadImage(const std::string& url, const std::string& localName
|
|||
return false;
|
||||
}
|
||||
FILE *f = nowide::fopen(localName.c_str(), "wb");
|
||||
if (f == NULL)
|
||||
if (f == nullptr)
|
||||
{
|
||||
WARN_LOG(COMMON, "can't create local file %s: error %d", localName.c_str(), errno);
|
||||
return false;
|
||||
|
|
|
@ -38,8 +38,8 @@ public:
|
|||
virtual void present() = 0;
|
||||
virtual void setFrameRendered() {}
|
||||
|
||||
virtual ImTextureID getTexture(const std::string& name) { return ImTextureID{}; }
|
||||
virtual ImTextureID updateTexture(const std::string& name, const u8 *data, int width, int height) { return ImTextureID{}; }
|
||||
virtual ImTextureID getTexture(const std::string& name) = 0;
|
||||
virtual ImTextureID updateTexture(const std::string& name, const u8 *data, int width, int height) = 0;
|
||||
};
|
||||
|
||||
extern std::unique_ptr<ImGuiDriver> imguiDriver;
|
||||
|
|
Loading…
Reference in New Issue