diff --git a/include/config.h b/include/config.h index fcfc501..f8ada98 100644 --- a/include/config.h +++ b/include/config.h @@ -53,6 +53,7 @@ class Config std::string sBlacklistFilePath; std::string sOrphanRegex; std::string sCoverList; + std::string sReportFilePath; unsigned int iInstallerType; unsigned int iInstallerLanguage; int iRetries; diff --git a/main.cpp b/main.cpp index 1452a9e..141c65f 100644 --- a/main.cpp +++ b/main.cpp @@ -82,6 +82,7 @@ int main(int argc, char *argv[]) bool bNoDeb = false; bool bNoTarGz = false; bool bNoCover = false; + config.bReport = false; // Commandline options (no config file) options_cli_no_cfg.add_options() ("help,h", "Print help message") @@ -98,7 +99,7 @@ int main(int argc, char *argv[]) ("status", bpo::value(&config.bCheckStatus)->zero_tokens()->default_value(false), "Show status of files\n\nOutput format:\nstatuscode gamename filename filesize filehash\n\nStatus codes:\nOK - File is OK\nND - File is not downloaded\nMD5 - MD5 mismatch, different version") ("save-config", bpo::value(&config.bSaveConfig)->zero_tokens()->default_value(false), "Create config file with current settings") ("reset-config", bpo::value(&config.bResetConfig)->zero_tokens()->default_value(false), "Reset config settings to default") - ("report", bpo::value(&config.bReport)->zero_tokens()->default_value(false), "Save report of downloaded/repaired files") + ("report", bpo::value(&config.sReportFilePath)->implicit_value("lgogdownloader-report.log"), "Save report of downloaded/repaired files to specified file\nDefault filename: lgogdownloader-report.log") ("no-cover", bpo::value(&bNoCover)->zero_tokens()->default_value(false), "Don't download cover images. Overrides --cover option.\nUseful for making exceptions when \"cover\" is set to true in config file.") ; // Commandline options (config file) @@ -254,6 +255,9 @@ int main(int argc, char *argv[]) if (config.sOrphanRegex.empty()) config.sOrphanRegex = orphans_regex_default; + if (vm.count("report")) + config.bReport = true; + if (config.iWait > 0) config.iWait *= 1000; diff --git a/src/downloader.cpp b/src/downloader.cpp index f257535..f1e0f32 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -91,10 +91,10 @@ int Downloader::init() if (config.bReport && (config.bDownload || config.bRepair)) { - this->report_ofs.open("lgogdownloader-report.log"); + this->report_ofs.open(config.sReportFilePath); if (!this->report_ofs) { - std::cout << "Failed to create lgogdownloader-report.log" << std::endl; + std::cout << "Failed to create " << config.sReportFilePath << std::endl; return 1; } }