mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 07:35:38 +00:00
Fixed an issue where mutually exclusive system variables could lead to theme loading errors.
This commit is contained in:
parent
d2e5dbf49a
commit
103e59b54d
|
@ -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<std::string, std::string> sysData;
|
||||
sysData.insert(std::pair<std::string, std::string>("system.name", getName()));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.theme", getThemeFolder()));
|
||||
|
@ -1315,6 +1317,10 @@ void SystemData::loadTheme()
|
|||
std::pair<std::string, std::string>("system.fullName.collections", getFullName()));
|
||||
sysData.insert(
|
||||
std::pair<std::string, std::string>("system.theme.collections", getThemeFolder()));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.name.noCollections", "\b"));
|
||||
sysData.insert(
|
||||
std::pair<std::string, std::string>("system.fullName.noCollections", "\b"));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.theme.noCollections", "\b"));
|
||||
}
|
||||
else {
|
||||
sysData.insert(
|
||||
|
@ -1323,6 +1329,10 @@ void SystemData::loadTheme()
|
|||
getFullName()));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.theme.noCollections",
|
||||
getThemeFolder()));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.name.collections", "\b"));
|
||||
sysData.insert(
|
||||
std::pair<std::string, std::string>("system.fullName.collections", "\b"));
|
||||
sysData.insert(std::pair<std::string, std::string>("system.theme.collections", "\b"));
|
||||
}
|
||||
|
||||
mTheme->loadFile(sysData, path);
|
||||
|
|
|
@ -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 == "")
|
||||
|
|
Loading…
Reference in a new issue