Small change to the Gamelist log output when updating the alternativeEmulator tag.

This commit is contained in:
Leon Styhre 2021-08-25 20:58:03 +02:00
parent 38c7ebc376
commit da2e5f07f1

View file

@ -258,6 +258,7 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
pugi::xml_document doc;
pugi::xml_node root;
std::string xmlReadPath = system->getGamelistPath(false);
bool hasAlternativeEmulatorTag = false;
if (Utils::FileSystem::exists(xmlReadPath)) {
// Parse an existing file first.
@ -283,6 +284,9 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
if (updateAlternativeEmulator) {
pugi::xml_node alternativeEmulator = doc.child("alternativeEmulator");
if (alternativeEmulator)
hasAlternativeEmulatorTag = true;
if (system->getAlternativeEmulator() != "") {
if (!alternativeEmulator) {
doc.prepend_child("alternativeEmulator");
@ -373,14 +377,14 @@ void updateGamelist(SystemData* system, bool updateAlternativeEmulator)
Utils::FileSystem::createDirectory(Utils::FileSystem::getParent(xmlWritePath));
if (updateAlternativeEmulator) {
if (system->getAlternativeEmulator() == "") {
if (hasAlternativeEmulatorTag && system->getAlternativeEmulator() == "") {
LOG(LogDebug) << "Gamelist::updateGamelist(): Removed the "
"alternativeEmulator tag for system \""
<< system->getName() << "\" as the default emulator \""
<< system->getSystemEnvData()->mLaunchCommands.front().second
<< "\" was selected";
}
else {
else if (system->getAlternativeEmulator() != "") {
LOG(LogDebug) << "Gamelist::updateGamelist(): "
"Added/updated the alternativeEmulator tag for system \""
<< system->getName() << "\" to \""