mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Merge pull request #45 from joolswills/display_name
add a getDisplayName function, which is used for rom display, and mak…
This commit is contained in:
commit
866ea49b7d
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue