Fix transforming gamename using multiple rules

The transformation was always applied to original name.
This fixes it by applying additional rules to already transfromed name.
This commit is contained in:
Sude 2023-04-16 13:08:31 +03:00
parent 19815109c3
commit a1a7fb4a28

View File

@ -445,11 +445,11 @@ void Util::filepathReplaceReservedStrings(std::string& str, const std::string& g
{ {
boost::regex expression(transformMatch); boost::regex expression(transformMatch);
boost::match_results<std::string::const_iterator> what; boost::match_results<std::string::const_iterator> what;
if (boost::regex_search(gamename, what, expression)) if (boost::regex_search(gamename_transformed, what, expression))
{ {
boost::regex transformRegex(Globals::globalConfig.transformationsJSON[transformMatch]["regex"].asString()); boost::regex transformRegex(Globals::globalConfig.transformationsJSON[transformMatch]["regex"].asString());
std::string transformReplacement = Globals::globalConfig.transformationsJSON[transformMatch]["replacement"].asString(); std::string transformReplacement = Globals::globalConfig.transformationsJSON[transformMatch]["replacement"].asString();
gamename_transformed = boost::regex_replace(gamename, transformRegex, transformReplacement); gamename_transformed = boost::regex_replace(gamename_transformed, transformRegex, transformReplacement);
} }
} }