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 checkStatus();
|
||||
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();
|
||||
CURL* curlhandle;
|
||||
Timer timer;
|
||||
|
7
main.cpp
7
main.cpp
@ -550,6 +550,9 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int res = 0;
|
||||
|
||||
if (config.bShowWishlist)
|
||||
downloader.showWishlist();
|
||||
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++)
|
||||
{
|
||||
downloader.downloadFileWithId(*it, config.sOutputFilename);
|
||||
res |= downloader.downloadFileWithId(*it, config.sOutputFilename) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
else if (config.bRepair) // Repair file
|
||||
@ -587,5 +590,5 @@ int main(int argc, char *argv[])
|
||||
if (!config.sOrphanRegex.empty() && config.bDownload)
|
||||
downloader.checkOrphans();
|
||||
|
||||
return 0;
|
||||
return res;
|
||||
}
|
||||
|
@ -2790,8 +2790,9 @@ void Downloader::saveChangelog(const std::string& changelog, const std::string&
|
||||
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("/");
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
@ -2825,7 +2826,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
||||
else
|
||||
filepath = output_filepath;
|
||||
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;
|
||||
}
|
||||
else
|
||||
@ -2835,7 +2836,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
return res;
|
||||
}
|
||||
|
||||
void Downloader::showWishlist()
|
||||
|
Loading…
Reference in New Issue
Block a user