diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index a33adf38c..1959b3282 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -1303,7 +1303,9 @@ void SystemData::loadTheme() } try { - // Build map with system variables for theme to use. + // Build a map with system variables for the theme to use. Assign a backspace character + // to the variables that are not applicable. This will be used in ThemeData to make sure + // unpopulated system variables do not lead to theme loading errors. std::map sysData; sysData.insert(std::pair("system.name", getName())); sysData.insert(std::pair("system.theme", getThemeFolder())); @@ -1315,6 +1317,10 @@ void SystemData::loadTheme() std::pair("system.fullName.collections", getFullName())); sysData.insert( std::pair("system.theme.collections", getThemeFolder())); + sysData.insert(std::pair("system.name.noCollections", "\b")); + sysData.insert( + std::pair("system.fullName.noCollections", "\b")); + sysData.insert(std::pair("system.theme.noCollections", "\b")); } else { sysData.insert( @@ -1323,6 +1329,10 @@ void SystemData::loadTheme() getFullName())); sysData.insert(std::pair("system.theme.noCollections", getThemeFolder())); + sysData.insert(std::pair("system.name.collections", "\b")); + sysData.insert( + std::pair("system.fullName.collections", "\b")); + sysData.insert(std::pair("system.theme.collections", "\b")); } mTheme->loadFile(sysData, path); diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 495d03516..bbf67443e 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -1205,6 +1205,14 @@ void ThemeData::parseElement(const pugi::xml_node& root, std::string str {resolvePlaceholders(node.text().as_string())}; + // Handle the special case with mutually exclusive system variables, for example + // system.fullName.collections and system.fullName.noCollections which can never + // exist at the same time. A backspace is assigned in SystemData to flag the + // variables that do not apply and if it's encountered here we simply skip the + // property. + if (!mLegacyTheme && str == "\b") + continue; + // Skip this check for legacy themes to not break backward compatibility with some // themes sets that include empty property values. if (!mLegacyTheme && str == "")