mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 03:39:17 +01:00
Galaxy: Fix getting file name
GOG changed part of the API which caused lgogdownloader to not get valid file name. Change galaxyAPI::installerJsonNodeToGameFileVector and galaxyAPI::extraJsonNodeToGameFileVector to get proper file name.
This commit is contained in:
parent
6c2a3b4392
commit
79aa66a2d3
@ -382,14 +382,15 @@ std::vector<gameFile> galaxyAPI::installerJsonNodeToGameFileVector(const std::st
|
||||
delete jsonparser;
|
||||
|
||||
std::string downlink_url = downlinkJson["downlink"].asString();
|
||||
std::string downlink_url_unescaped = (std::string)curl_easy_unescape(curlhandle, downlink_url.c_str(), downlink_url.size(), NULL);
|
||||
std::string path;
|
||||
if (downlink_url.find("/" + gamename + "/") != std::string::npos)
|
||||
if (downlink_url_unescaped.find("/" + gamename + "/") != std::string::npos)
|
||||
{
|
||||
path.assign(downlink_url.begin()+downlink_url.find("/" + gamename + "/"), downlink_url.begin()+downlink_url.find_first_of("?"));
|
||||
path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find("/" + gamename + "/"), downlink_url_unescaped.begin()+downlink_url_unescaped.find_first_of("&"));
|
||||
}
|
||||
else
|
||||
{
|
||||
path.assign(downlink_url.begin()+downlink_url.find_last_of("/")+1, downlink_url.begin()+downlink_url.find_first_of("?"));
|
||||
path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find_last_of("/")+1, downlink_url_unescaped.begin()+downlink_url_unescaped.find_first_of("&"));
|
||||
path = "/" + gamename + "/" + path;
|
||||
}
|
||||
|
||||
@ -462,12 +463,15 @@ std::vector<gameFile> galaxyAPI::extraJsonNodeToGameFileVector(const std::string
|
||||
delete jsonparser;
|
||||
|
||||
std::string downlink_url = downlinkJson["downlink"].asString();
|
||||
std::string downlink_url_unescaped = (std::string)curl_easy_unescape(curlhandle, downlink_url.c_str(), downlink_url.size(), NULL);
|
||||
std::string path;
|
||||
if (downlink_url.find("/" + gamename + "/") != std::string::npos)
|
||||
path.assign(downlink_url.begin()+downlink_url.find("/" + gamename + "/"), downlink_url.begin()+downlink_url.find_first_of("?"));
|
||||
if (downlink_url_unescaped.find("/" + gamename + "/") != std::string::npos)
|
||||
{
|
||||
path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find("/" + gamename + "/"), downlink_url_unescaped.begin()+downlink_url_unescaped.find_first_of("&"));
|
||||
}
|
||||
else
|
||||
{
|
||||
path.assign(downlink_url.begin()+downlink_url.find_last_of("/")+1, downlink_url.begin()+downlink_url.find_first_of("?"));
|
||||
path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find_last_of("/")+1, downlink_url_unescaped.begin()+downlink_url_unescaped.find_first_of("&"));
|
||||
path = "/" + gamename + "/extras/" + path;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user