mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Better handling of empty %platform% in Util::filepathReplaceReservedStrings
This commit is contained in:
parent
b954df2bbc
commit
6b0a39774a
11
src/util.cpp
11
src/util.cpp
@ -293,8 +293,6 @@ int Util::replaceString(std::string& str, const std::string& to_replace, const s
|
||||
void Util::filepathReplaceReservedStrings(std::string& str, const std::string& gamename, const unsigned int& platformId, const std::string& dlcname)
|
||||
{
|
||||
std::string platform;
|
||||
while (Util::replaceString(str, "%gamename%", gamename));
|
||||
while (Util::replaceString(str, "%dlcname%", dlcname));
|
||||
for (unsigned int i = 0; i < GlobalConstants::PLATFORMS.size(); ++i)
|
||||
{
|
||||
if ((platformId & GlobalConstants::PLATFORMS[i].platformId) == GlobalConstants::PLATFORMS[i].platformId)
|
||||
@ -303,7 +301,16 @@ void Util::filepathReplaceReservedStrings(std::string& str, const std::string& g
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (platform.empty())
|
||||
{
|
||||
if (str.find("%gamename%/%platform%") != std::string::npos)
|
||||
platform = "";
|
||||
else
|
||||
platform = "no_platform";
|
||||
}
|
||||
|
||||
while (Util::replaceString(str, "%gamename%", gamename));
|
||||
while (Util::replaceString(str, "%dlcname%", dlcname));
|
||||
while (Util::replaceString(str, "%platform%", platform));
|
||||
while (Util::replaceString(str, "//", "/")); // Replace any double slashes with single slash
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user