summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-05-24 14:49:54 +0200
committerPetr Mrázek <peterix@gmail.com>2015-05-24 14:49:54 +0200
commitdfb0a3b724f624532557fe7cb20e8678560f444c (patch)
tree64ea831d95c2bb84c360c9f79559ffa5f7140467 /logic
parentce99fabe1396ed2956dc7ecb468760ef88f98765 (diff)
downloadMultiMC-dfb0a3b724f624532557fe7cb20e8678560f444c.tar
MultiMC-dfb0a3b724f624532557fe7cb20e8678560f444c.tar.gz
MultiMC-dfb0a3b724f624532557fe7cb20e8678560f444c.tar.lz
MultiMC-dfb0a3b724f624532557fe7cb20e8678560f444c.tar.xz
MultiMC-dfb0a3b724f624532557fe7cb20e8678560f444c.zip
GH-991 implement wrapper commands
Diffstat (limited to 'logic')
-rw-r--r--logic/BaseInstance.cpp1
-rw-r--r--logic/minecraft/MinecraftProcess.cpp23
2 files changed, 22 insertions, 2 deletions
diff --git a/logic/BaseInstance.cpp b/logic/BaseInstance.cpp
index 661e4587..0a0bc961 100644
--- a/logic/BaseInstance.cpp
+++ b/logic/BaseInstance.cpp
@@ -42,6 +42,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s
// Custom Commands
m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false);
m_settings->registerOverride(globalSettings->getSetting("PreLaunchCommand"));
+ m_settings->registerOverride(globalSettings->getSetting("WrapperCommand"));
m_settings->registerOverride(globalSettings->getSetting("PostExitCommand"));
// Console
diff --git a/logic/minecraft/MinecraftProcess.cpp b/logic/minecraft/MinecraftProcess.cpp
index d52eb97c..71dd81ed 100644
--- a/logic/minecraft/MinecraftProcess.cpp
+++ b/logic/minecraft/MinecraftProcess.cpp
@@ -238,8 +238,27 @@ void MinecraftProcess::arm()
QString allArgs = args.join(", ");
emit log("Java Arguments:\n[" + censorPrivateInfo(allArgs) + "]\n\n");
- // instantiate the launcher part
- start(JavaPath, args);
+ QString wrapperCommand = m_instance->settings()->get("WrapperCommand").toString();
+ if(!wrapperCommand.isEmpty())
+ {
+ auto realWrapperCommand = QStandardPaths::findExecutable(wrapperCommand);
+ if (realWrapperCommand.isEmpty())
+ {
+ emit log(tr("The wrapper command \"%1\" couldn't be found.").arg(wrapperCommand), MessageLevel::Warning);
+ m_instance->cleanupAfterRun();
+ emit launch_failed(m_instance);
+ m_instance->setRunning(false);
+ return;
+ }
+ emit log("Wrapper command is:\n" + wrapperCommand + "\n\n");
+ args.prepend(JavaPath);
+ start(wrapperCommand, args);
+ }
+ else
+ {
+ start(JavaPath, args);
+ }
+
if (!waitForStarted())
{
//: Error message displayed if instace can't start