(Windows) Converted forward slashes to backslashes for some log output entries involving file names.

Also made some minor general log output changes in GamelistFileParser.
This commit is contained in:
Leon Styhre 2022-12-19 20:38:41 +01:00
parent 607e6f2845
commit a54d6a5568
2 changed files with 44 additions and 10 deletions

View file

@ -76,7 +76,11 @@ namespace GamelistFileParser
if (std::find(extensions.cbegin(), extensions.cend(), if (std::find(extensions.cbegin(), extensions.cend(),
Utils::FileSystem::getExtension(path)) == extensions.cend()) { Utils::FileSystem::getExtension(path)) == extensions.cend()) {
#if defined(_WIN64)
LOG(LogWarning) << "File \"" << Utils::String::replace(path, "/", "\\")
#else
LOG(LogWarning) << "File \"" << path LOG(LogWarning) << "File \"" << path
#endif
<< "\" is present in gamelist.xml but the extension is not " << "\" is present in gamelist.xml but the extension is not "
"configured in es_systems.xml"; "configured in es_systems.xml";
return nullptr; return nullptr;
@ -198,7 +202,7 @@ namespace GamelistFileParser
#else #else
LOG(LogWarning) << (type == GAME ? "File \"" : "Folder \"") << path LOG(LogWarning) << (type == GAME ? "File \"" : "Folder \"") << path
#endif #endif
<< "\" does not exist, ignoring entry"; << "\" does not exist, skipping entry";
continue; continue;
} }
@ -223,7 +227,13 @@ namespace GamelistFileParser
} }
if (!file) { if (!file) {
LOG(LogError) << "Couldn't find or create \"" << path << "\", skipping entry"; #if defined(_WIN64)
LOG(LogWarning)
<< "Couldn't process \"" << Utils::String::replace(path, "/", "\\")
<< "\", skipping entry";
#else
LOG(LogWarning) << "Couldn't process \"" << path << "\", skipping entry";
#endif
continue; continue;
} }
else if (!file->isArcadeAsset()) { else if (!file->isArcadeAsset()) {

View file

@ -1106,10 +1106,18 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") || if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") ||
(mCustomCollection && Settings::getInstance()->getBool( (mCustomCollection && Settings::getInstance()->getBool(
"DebugSkipMissingThemeFilesCustomCollections")))) { "DebugSkipMissingThemeFilesCustomCollections")))) {
#if defined(_WIN64)
LOG(LogDebug) << Utils::String::replace(error.message, "/", "\\")
<< ": Couldn't find file \"" << node.text().get() << "\" "
<< ((node.text().get() != path) ?
"which resolves to \"" +
Utils::String::replace(path, "/", "\\") + "\"" :
#else
LOG(LogDebug) << error.message << ": Couldn't find file \"" << node.text().get() LOG(LogDebug) << error.message << ": Couldn't find file \"" << node.text().get()
<< "\" " << "\" "
<< ((node.text().get() != path) ? << ((node.text().get() != path) ?
"which resolves to \"" + path + "\"" : "which resolves to \"" + path + "\"" :
#endif
""); "");
} }
return; return;
@ -1584,27 +1592,43 @@ void ThemeData::parseElement(const pugi::xml_node& root,
// For explicit paths, print a warning if the file couldn't be found, but // For explicit paths, print a warning if the file couldn't be found, but
// only print a debug message if it was set using a variable. // only print a debug message if it was set using a variable.
if (str == node.text().as_string()) { if (str == node.text().as_string()) {
#if defined(_WIN64)
LOG(LogWarning) << Utils::String::replace(error.message, "/", "\\")
<< ": Couldn't find file \"" << node.text().get() << "\" "
<< ((node.text().get() != path) ?
"which resolves to \"" +
Utils::String::replace(path, "/", "\\") + "\"" :
#else
LOG(LogWarning) LOG(LogWarning)
<< error.message << ": Couldn't find file \"" << node.text().get() << error.message << ": Couldn't find file \"" << node.text().get()
<< "\" " << "\" "
<< ((node.text().get() != path) ? "which resolves to \"" + path + "\"" : << ((node.text().get() != path) ? "which resolves to \"" + path + "\"" :
"") #endif
<< " (element type \"" << element.type << "\", name \"" "")
<< root.attribute("name").as_string() << "\", property \"" << nodeName << " (element type \"" << element.type << "\", name \""
<< "\")"; << root.attribute("name").as_string() << "\", property \""
<< nodeName << "\")";
} }
else if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") || else if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") ||
(mCustomCollection && (mCustomCollection &&
Settings::getInstance()->getBool( Settings::getInstance()->getBool(
"DebugSkipMissingThemeFilesCustomCollections")))) { "DebugSkipMissingThemeFilesCustomCollections")))) {
#if defined(_WIN64)
LOG(LogDebug) << Utils::String::replace(error.message, "/", "\\")
<< ": Couldn't find file \"" << node.text().get() << "\" "
<< ((node.text().get() != path) ?
"which resolves to \"" +
Utils::String::replace(path, "/", "\\") + "\"" :
#else
LOG(LogDebug) LOG(LogDebug)
<< error.message << ": Couldn't find file \"" << node.text().get() << error.message << ": Couldn't find file \"" << node.text().get()
<< "\" " << "\" "
<< ((node.text().get() != path) ? "which resolves to \"" + path + "\"" : << ((node.text().get() != path) ? "which resolves to \"" + path + "\"" :
"") #endif
<< " (element type \"" << element.type << "\", name \"" "")
<< root.attribute("name").as_string() << "\", property \"" << nodeName << " (element type \"" << element.type << "\", name \""
<< "\")"; << root.attribute("name").as_string() << "\", property \""
<< nodeName << "\")";
} }
} }
element.properties[nodeName] = path; element.properties[nodeName] = path;