From a54d6a5568bbad97196015f3f45d318d65d84d77 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 19 Dec 2022 20:38:41 +0100 Subject: [PATCH] (Windows) Converted forward slashes to backslashes for some log output entries involving file names. Also made some minor general log output changes in GamelistFileParser. --- es-app/src/GamelistFileParser.cpp | 14 +++++++++-- es-core/src/ThemeData.cpp | 40 ++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/es-app/src/GamelistFileParser.cpp b/es-app/src/GamelistFileParser.cpp index eebf13da1..7bb0e693f 100644 --- a/es-app/src/GamelistFileParser.cpp +++ b/es-app/src/GamelistFileParser.cpp @@ -76,7 +76,11 @@ namespace GamelistFileParser if (std::find(extensions.cbegin(), extensions.cend(), Utils::FileSystem::getExtension(path)) == extensions.cend()) { +#if defined(_WIN64) + LOG(LogWarning) << "File \"" << Utils::String::replace(path, "/", "\\") +#else LOG(LogWarning) << "File \"" << path +#endif << "\" is present in gamelist.xml but the extension is not " "configured in es_systems.xml"; return nullptr; @@ -198,7 +202,7 @@ namespace GamelistFileParser #else LOG(LogWarning) << (type == GAME ? "File \"" : "Folder \"") << path #endif - << "\" does not exist, ignoring entry"; + << "\" does not exist, skipping entry"; continue; } @@ -223,7 +227,13 @@ namespace GamelistFileParser } 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; } else if (!file->isArcadeAsset()) { diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 73d8ef7d6..cbb9dd02d 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -1106,10 +1106,18 @@ void ThemeData::parseIncludes(const pugi::xml_node& root) if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") || (mCustomCollection && Settings::getInstance()->getBool( "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() << "\" " << ((node.text().get() != path) ? "which resolves to \"" + path + "\"" : +#endif ""); } 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 // only print a debug message if it was set using a variable. 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) << error.message << ": Couldn't find file \"" << node.text().get() << "\" " << ((node.text().get() != path) ? "which resolves to \"" + path + "\"" : - "") - << " (element type \"" << element.type << "\", name \"" - << root.attribute("name").as_string() << "\", property \"" << nodeName - << "\")"; +#endif + "") + << " (element type \"" << element.type << "\", name \"" + << root.attribute("name").as_string() << "\", property \"" + << nodeName << "\")"; } else if (!(Settings::getInstance()->getBool("DebugSkipMissingThemeFiles") || (mCustomCollection && Settings::getInstance()->getBool( "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() << "\" " << ((node.text().get() != path) ? "which resolves to \"" + path + "\"" : - "") - << " (element type \"" << element.type << "\", name \"" - << root.attribute("name").as_string() << "\", property \"" << nodeName - << "\")"; +#endif + "") + << " (element type \"" << element.type << "\", name \"" + << root.attribute("name").as_string() << "\", property \"" + << nodeName << "\")"; } } element.properties[nodeName] = path;