diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index d4279105b..f9f28185b 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -48,7 +48,7 @@ FileData::FileData(FileType type, const fs::path& path, SystemData* system) { // metadata needs at least a name field (since that's what getName() will return) if(metadata.get("name").empty()) - metadata.set("name", getCleanName()); + metadata.set("name", getDisplayName()); } FileData::~FileData() @@ -60,7 +60,7 @@ FileData::~FileData() delete mChildren.back(); } -std::string FileData::getCleanName() const +std::string FileData::getDisplayName() const { std::string stem = mPath.stem().generic_string(); if(mSystem && mSystem->hasPlatformId(PlatformIds::ARCADE) || mSystem->hasPlatformId(PlatformIds::NEOGEO)) @@ -69,6 +69,11 @@ std::string FileData::getCleanName() const return stem; } +std::string FileData::getCleanName() const +{ + return removeParenthesis(this->getDisplayName()); +} + const std::string& FileData::getThumbnailPath() const { if(!metadata.get("thumbnail").empty()) diff --git a/es-app/src/FileData.h b/es-app/src/FileData.h index add6345f4..99fba0671 100644 --- a/es-app/src/FileData.h +++ b/es-app/src/FileData.h @@ -49,7 +49,10 @@ public: void addChild(FileData* file); // Error if mType != FOLDER void removeChild(FileData* file); //Error if mType != FOLDER - // Returns our best guess at the "real" name for this file (will strip parenthesis and attempt to perform MAME name translation) + // Returns our best guess at the "real" name for this file (will attempt to perform MAME name translation) + std::string getDisplayName() const; + + // As above, but also remove parenthesis std::string getCleanName() const; typedef bool ComparisonFunction(const FileData* a, const FileData* b); diff --git a/es-app/src/Gamelist.cpp b/es-app/src/Gamelist.cpp index 8c647fc4d..9caeda354 100644 --- a/es-app/src/Gamelist.cpp +++ b/es-app/src/Gamelist.cpp @@ -148,7 +148,7 @@ void addFileDataNode(pugi::xml_node& parent, const FileData* file, const char* t if(newNode.children().begin() == newNode.child("name") //first element is name && ++newNode.children().begin() == newNode.children().end() //theres only one element - && newNode.child("name").text().get() == file->getCleanName()) //the name is the default + && newNode.child("name").text().get() == file->getDisplayName()) //the name is the default { //if the only info is the default name, don't bother with this node //delete it and ultimately do nothing