NOISSUE split wrapper commands into command and args
This lets you use commands with parameters.
This commit is contained in:
parent
50b8412a26
commit
7acf1998eb
@ -17,6 +17,7 @@
|
|||||||
#include <launch/LaunchTask.h>
|
#include <launch/LaunchTask.h>
|
||||||
#include <minecraft/MinecraftInstance.h>
|
#include <minecraft/MinecraftInstance.h>
|
||||||
#include <FileSystem.h>
|
#include <FileSystem.h>
|
||||||
|
#include <Commandline.h>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
DirectJavaLaunch::DirectJavaLaunch(LaunchTask *parent) : LaunchStep(parent)
|
DirectJavaLaunch::DirectJavaLaunch(LaunchTask *parent) : LaunchStep(parent)
|
||||||
@ -57,9 +58,11 @@ void DirectJavaLaunch::executeTask()
|
|||||||
auto mcArgs = minecraftInstance->processMinecraftArgs(m_session);
|
auto mcArgs = minecraftInstance->processMinecraftArgs(m_session);
|
||||||
args.append(mcArgs);
|
args.append(mcArgs);
|
||||||
|
|
||||||
QString wrapperCommand = instance->getWrapperCommand();
|
QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
|
||||||
if(!wrapperCommand.isEmpty())
|
if(!wrapperCommandStr.isEmpty())
|
||||||
{
|
{
|
||||||
|
auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr);
|
||||||
|
auto wrapperCommand = wrapperArgs.takeFirst();
|
||||||
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
|
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
|
||||||
if (realWrapperCommand.isEmpty())
|
if (realWrapperCommand.isEmpty())
|
||||||
{
|
{
|
||||||
@ -68,9 +71,9 @@ void DirectJavaLaunch::executeTask()
|
|||||||
emitFailed(reason);
|
emitFailed(reason);
|
||||||
return;
|
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);
|
args.prepend(javaPath);
|
||||||
m_process.start(wrapperCommand, args);
|
m_process.start(wrapperCommand, wrapperArgs + args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <launch/LaunchTask.h>
|
#include <launch/LaunchTask.h>
|
||||||
#include <minecraft/MinecraftInstance.h>
|
#include <minecraft/MinecraftInstance.h>
|
||||||
#include <FileSystem.h>
|
#include <FileSystem.h>
|
||||||
|
#include <Commandline.h>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include "Env.h"
|
#include "Env.h"
|
||||||
|
|
||||||
@ -46,9 +47,11 @@ void LauncherPartLaunch::executeTask()
|
|||||||
|
|
||||||
args << "-jar" << FS::PathCombine(ENV.getJarsPath(), "NewLaunch.jar");
|
args << "-jar" << FS::PathCombine(ENV.getJarsPath(), "NewLaunch.jar");
|
||||||
|
|
||||||
QString wrapperCommand = instance->getWrapperCommand();
|
QString wrapperCommandStr = instance->getWrapperCommand().trimmed();
|
||||||
if(!wrapperCommand.isEmpty())
|
if(!wrapperCommandStr.isEmpty())
|
||||||
{
|
{
|
||||||
|
auto wrapperArgs = Commandline::splitArgs(wrapperCommandStr);
|
||||||
|
auto wrapperCommand = wrapperArgs.takeFirst();
|
||||||
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
|
auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
|
||||||
if (realWrapperCommand.isEmpty())
|
if (realWrapperCommand.isEmpty())
|
||||||
{
|
{
|
||||||
@ -57,9 +60,9 @@ void LauncherPartLaunch::executeTask()
|
|||||||
emitFailed(reason);
|
emitFailed(reason);
|
||||||
return;
|
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);
|
args.prepend(javaPath);
|
||||||
m_process.start(wrapperCommand, args);
|
m_process.start(wrapperCommand, wrapperArgs + args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user