From 7acf1998eb0683860dc21fc740f1e6bd42f54169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 29 May 2017 01:36:01 +0200 Subject: [PATCH] NOISSUE split wrapper commands into command and args This lets you use commands with parameters. --- api/logic/minecraft/launch/DirectJavaLaunch.cpp | 11 +++++++---- api/logic/minecraft/launch/LauncherPartLaunch.cpp | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/api/logic/minecraft/launch/DirectJavaLaunch.cpp b/api/logic/minecraft/launch/DirectJavaLaunch.cpp index d82d9ff2..07dbb86c 100644 --- a/api/logic/minecraft/launch/DirectJavaLaunch.cpp +++ b/api/logic/minecraft/launch/DirectJavaLaunch.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include DirectJavaLaunch::DirectJavaLaunch(LaunchTask *parent) : LaunchStep(parent) @@ -57,9 +58,11 @@ void DirectJavaLaunch::executeTask() auto mcArgs = minecraftInstance->processMinecraftArgs(m_session); args.append(mcArgs); - QString wrapperCommand = instance->getWrapperCommand(); - if(!wrapperCommand.isEmpty()) + QString wrapperCommandStr = instance->getWrapperCommand().trimmed(); + if(!wrapperCommandStr.isEmpty()) { + auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr); + auto wrapperCommand = wrapperArgs.takeFirst(); auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand); if (realWrapperCommand.isEmpty()) { @@ -68,9 +71,9 @@ void DirectJavaLaunch::executeTask() emitFailed(reason); return; } - emit logLine("Wrapper command is:\n" + wrapperCommand + "\n\n", MessageLevel::MultiMC); + emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::MultiMC); args.prepend(javaPath); - m_process.start(wrapperCommand, args); + m_process.start(wrapperCommand, wrapperArgs + args); } else { diff --git a/api/logic/minecraft/launch/LauncherPartLaunch.cpp b/api/logic/minecraft/launch/LauncherPartLaunch.cpp index d9441e56..b641968c 100644 --- a/api/logic/minecraft/launch/LauncherPartLaunch.cpp +++ b/api/logic/minecraft/launch/LauncherPartLaunch.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "Env.h" @@ -46,9 +47,11 @@ void LauncherPartLaunch::executeTask() args << "-jar" << FS::PathCombine(ENV.getJarsPath(), "NewLaunch.jar"); - QString wrapperCommand = instance->getWrapperCommand(); - if(!wrapperCommand.isEmpty()) + QString wrapperCommandStr = instance->getWrapperCommand().trimmed(); + if(!wrapperCommandStr.isEmpty()) { + auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr); + auto wrapperCommand = wrapperArgs.takeFirst(); auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand); if (realWrapperCommand.isEmpty()) { @@ -57,9 +60,9 @@ void LauncherPartLaunch::executeTask() emitFailed(reason); return; } - emit logLine("Wrapper command is:\n" + wrapperCommand + "\n\n", MessageLevel::MultiMC); + emit logLine("Wrapper command is:\n" + wrapperCommandStr + "\n\n", MessageLevel::MultiMC); args.prepend(javaPath); - m_process.start(wrapperCommand, args); + m_process.start(wrapperCommand, wrapperArgs + args); } else {