mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Exit with non-zero status when at least one --download-file fails
This commit is contained in:
parent
4ee63f7e87
commit
d8b8d6da96
@ -72,7 +72,7 @@ class Downloader
|
|||||||
void checkOrphans();
|
void checkOrphans();
|
||||||
void checkStatus();
|
void checkStatus();
|
||||||
void updateCache();
|
void updateCache();
|
||||||
void downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath);
|
int downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath);
|
||||||
void showWishlist();
|
void showWishlist();
|
||||||
CURL* curlhandle;
|
CURL* curlhandle;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
7
main.cpp
7
main.cpp
@ -550,6 +550,9 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
if (config.bShowWishlist)
|
if (config.bShowWishlist)
|
||||||
downloader.showWishlist();
|
downloader.showWishlist();
|
||||||
else if (config.bUpdateCache)
|
else if (config.bUpdateCache)
|
||||||
@ -560,7 +563,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for (std::vector<std::string>::iterator it = vFileIdStrings.begin(); it != vFileIdStrings.end(); it++)
|
for (std::vector<std::string>::iterator it = vFileIdStrings.begin(); it != vFileIdStrings.end(); it++)
|
||||||
{
|
{
|
||||||
downloader.downloadFileWithId(*it, config.sOutputFilename);
|
res |= downloader.downloadFileWithId(*it, config.sOutputFilename) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (config.bRepair) // Repair file
|
else if (config.bRepair) // Repair file
|
||||||
@ -587,5 +590,5 @@ int main(int argc, char *argv[])
|
|||||||
if (!config.sOrphanRegex.empty() && config.bDownload)
|
if (!config.sOrphanRegex.empty() && config.bDownload)
|
||||||
downloader.checkOrphans();
|
downloader.checkOrphans();
|
||||||
|
|
||||||
return 0;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -2790,8 +2790,9 @@ void Downloader::saveChangelog(const std::string& changelog, const std::string&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath)
|
int Downloader::downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath)
|
||||||
{
|
{
|
||||||
|
int res = 1;
|
||||||
size_t pos = fileid_string.find("/");
|
size_t pos = fileid_string.find("/");
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
{
|
{
|
||||||
@ -2825,7 +2826,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
|||||||
else
|
else
|
||||||
filepath = output_filepath;
|
filepath = output_filepath;
|
||||||
std::cout << "Downloading: " << filepath << std::endl;
|
std::cout << "Downloading: " << filepath << std::endl;
|
||||||
this->downloadFile(url, filepath, std::string(), gamename);
|
res = this->downloadFile(url, filepath, std::string(), gamename);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2835,7 +2836,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::showWishlist()
|
void Downloader::showWishlist()
|
||||||
|
Loading…
Reference in New Issue
Block a user