diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2026-05-04 16:40:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-04 16:40:32 -0500 |
| commit | f5d89ad6250343acddbcd5541fb6e7b7df4f27d2 (patch) | |
| tree | f3274f5c5b597d34fa367a73833f8e0b1aa9e94e /src/commandline.cpp | |
| parent | ca7a149874e99a8f401cb30c430f58a48be4c642 (diff) | |
Download command: Add game instance check (#2388)
* Add game instance check
- Should be ignored if not passed to command
- Functions much like NXM game check
Diffstat (limited to 'src/commandline.cpp')
| -rw-r--r-- | src/commandline.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/commandline.cpp b/src/commandline.cpp index 3aa4b1ca..769403c4 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -857,7 +857,8 @@ po::options_description DownloadFileCommand::getVisibleOptions() const { po::options_description d; - d.add_options()("name,n", po::value<std::string>(), "(optional) the download name")( + d.add_options()("game,g", po::value<std::string>(), "managed game")( + "name,n", po::value<std::string>(), "(optional) the download name")( "modname,m", po::value<std::string>(), "(optional) the mod name")( "version,v", po::value<std::string>(), "(optional) the download / mod version")( "source,s", po::value<std::string>(), "(optional) the download source"); @@ -891,6 +892,7 @@ bool DownloadFileCommand::canForwardToPrimary() const std::optional<int> DownloadFileCommand::runPostOrganizer(OrganizerCore& core) { const QString url = QString::fromStdString(vm()["URL"].as<std::string>()); + QString game(""); QString name, modName, version, source; if (!url.startsWith("https://")) { @@ -898,6 +900,10 @@ std::optional<int> DownloadFileCommand::runPostOrganizer(OrganizerCore& core) return 1; } + if (vm().count("game")) { + game = QString::fromStdString(vm()["game"].as<std::string>()); + } + if (vm().count("name")) { name = QString::fromStdString(vm()["name"].as<std::string>()); } @@ -917,7 +923,8 @@ std::optional<int> DownloadFileCommand::runPostOrganizer(OrganizerCore& core) log::debug("starting direct download from command line: {}", url.toStdString()); MessageDialog::showMessage(QObject::tr("Download started"), qApp->activeWindow(), false); - core.downloadManager()->startDownloadURLWithMeta(url, name, modName, version, source); + core.downloadManager()->startDownloadURLWithMeta(url, game, name, modName, version, + source); return {}; } |
