From f5d89ad6250343acddbcd5541fb6e7b7df4f27d2 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 4 May 2026 16:40:32 -0500 Subject: 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 --- src/commandline.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/commandline.cpp') 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(), "(optional) the download name")( + d.add_options()("game,g", po::value(), "managed game")( + "name,n", po::value(), "(optional) the download name")( "modname,m", po::value(), "(optional) the mod name")( "version,v", po::value(), "(optional) the download / mod version")( "source,s", po::value(), "(optional) the download source"); @@ -891,6 +892,7 @@ bool DownloadFileCommand::canForwardToPrimary() const std::optional DownloadFileCommand::runPostOrganizer(OrganizerCore& core) { const QString url = QString::fromStdString(vm()["URL"].as()); + QString game(""); QString name, modName, version, source; if (!url.startsWith("https://")) { @@ -898,6 +900,10 @@ std::optional DownloadFileCommand::runPostOrganizer(OrganizerCore& core) return 1; } + if (vm().count("game")) { + game = QString::fromStdString(vm()["game"].as()); + } + if (vm().count("name")) { name = QString::fromStdString(vm()["name"].as()); } @@ -917,7 +923,8 @@ std::optional 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 {}; } -- cgit v1.3.1