Exit with non-zero status when --list or --list-details fails

This commit is contained in:
James Le Cuirot 2016-09-23 22:20:37 +01:00
parent d8b8d6da96
commit 1388c00a4e
No known key found for this signature in database
GPG Key ID: 21C632129C6D7DE4
3 changed files with 9 additions and 5 deletions

View File

@ -65,7 +65,7 @@ class Downloader
virtual ~Downloader();
int init();
int login();
void listGames();
int listGames();
void updateCheck();
void repair();
void download();

View File

@ -571,7 +571,7 @@ int main(int argc, char *argv[])
else if (config.bDownload) // Download games
downloader.download();
else if (config.bListDetails || config.bList) // Detailed list of games/extras
downloader.listGames();
res = downloader.listGames();
else if (!config.sOrphanRegex.empty()) // Check for orphaned files if regex for orphans is set
downloader.checkOrphans();
else if (config.bCheckStatus)

View File

@ -495,12 +495,15 @@ int Downloader::getGameDetails()
return 0;
}
void Downloader::listGames()
int Downloader::listGames()
{
if (config.bListDetails) // Detailed list
{
if (this->games.empty())
this->getGameDetails();
if (this->games.empty()) {
int res = this->getGameDetails();
if (res > 0)
return res;
}
for (unsigned int i = 0; i < games.size(); ++i)
{
@ -696,6 +699,7 @@ void Downloader::listGames()
}
}
return 0;
}
void Downloader::repair()