mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Fix getting DLC names
This commit is contained in:
parent
b1d54e70f7
commit
3f6b2315eb
@ -70,7 +70,7 @@ namespace Util
|
|||||||
void filepathReplaceReservedStrings(std::string& str, const std::string& gamename, const unsigned int& platformId = 0, const std::string& dlcname = "");
|
void filepathReplaceReservedStrings(std::string& str, const std::string& gamename, const unsigned int& platformId = 0, const std::string& dlcname = "");
|
||||||
void setFilePermissions(const boost::filesystem::path& path, const boost::filesystem::perms& permissions);
|
void setFilePermissions(const boost::filesystem::path& path, const boost::filesystem::perms& permissions);
|
||||||
int getTerminalWidth();
|
int getTerminalWidth();
|
||||||
void getDownloaderUrlsFromJSON(const Json::Value &root, std::vector<std::string> &urls);
|
void getManualUrlsFromJSON(const Json::Value &root, std::vector<std::string> &urls);
|
||||||
std::vector<std::string> getDLCNamesFromJSON(const Json::Value &root);
|
std::vector<std::string> getDLCNamesFromJSON(const Json::Value &root);
|
||||||
std::string getHomeDir();
|
std::string getHomeDir();
|
||||||
std::string getConfigHome();
|
std::string getConfigHome();
|
||||||
|
13
src/util.cpp
13
src/util.cpp
@ -480,18 +480,18 @@ int Util::getTerminalWidth()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Util::getDownloaderUrlsFromJSON(const Json::Value &root, std::vector<std::string> &urls)
|
void Util::getManualUrlsFromJSON(const Json::Value &root, std::vector<std::string> &urls)
|
||||||
{
|
{
|
||||||
if(root.size() > 0) {
|
if(root.size() > 0) {
|
||||||
for(Json::ValueConstIterator it = root.begin() ; it != root.end() ; ++it)
|
for(Json::ValueConstIterator it = root.begin() ; it != root.end() ; ++it)
|
||||||
{
|
{
|
||||||
if (it.key() == "downloaderUrl")
|
if (it.key() == "manualUrl")
|
||||||
{
|
{
|
||||||
Json::Value url = *it;
|
Json::Value url = *it;
|
||||||
urls.push_back(url.asString());
|
urls.push_back(url.asString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
getDownloaderUrlsFromJSON(*it, urls);
|
getManualUrlsFromJSON(*it, urls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -500,15 +500,14 @@ void Util::getDownloaderUrlsFromJSON(const Json::Value &root, std::vector<std::s
|
|||||||
std::vector<std::string> Util::getDLCNamesFromJSON(const Json::Value &root)
|
std::vector<std::string> Util::getDLCNamesFromJSON(const Json::Value &root)
|
||||||
{
|
{
|
||||||
std::vector<std::string> urls, dlcnames;
|
std::vector<std::string> urls, dlcnames;
|
||||||
getDownloaderUrlsFromJSON(root, urls);
|
getManualUrlsFromJSON(root, urls);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < urls.size(); ++i)
|
for (unsigned int i = 0; i < urls.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string gamename;
|
std::string gamename;
|
||||||
if (urls[i].find(GlobalConstants::PROTOCOL_PREFIX) == std::string::npos)
|
std::string url_prefix = "/downloads/";
|
||||||
continue;
|
|
||||||
|
|
||||||
gamename.assign(urls[i].begin()+urls[i].find(GlobalConstants::PROTOCOL_PREFIX)+GlobalConstants::PROTOCOL_PREFIX.length(), urls[i].begin()+urls[i].find_last_of("/"));
|
gamename.assign(urls[i].begin()+urls[i].find(url_prefix)+url_prefix.length(), urls[i].begin()+urls[i].find_last_of("/"));
|
||||||
bool bDuplicate = false;
|
bool bDuplicate = false;
|
||||||
for (unsigned int j = 0; j < dlcnames.size(); ++j)
|
for (unsigned int j = 0; j < dlcnames.size(); ++j)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user