From bc917668ff9ab193ed66b390dd4f0e0bcef4cb43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 24 Aug 2015 00:56:45 +0200 Subject: [PATCH] GH-1133 fix bad java path detection some more --- logic/launch/steps/CheckJava.cpp | 13 +++++++++---- logic/minecraft/LegacyInstance.cpp | 5 +++++ logic/minecraft/OneSixInstance.cpp | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/logic/launch/steps/CheckJava.cpp b/logic/launch/steps/CheckJava.cpp index 22f62057..4a9fcbf9 100644 --- a/logic/launch/steps/CheckJava.cpp +++ b/logic/launch/steps/CheckJava.cpp @@ -21,15 +21,19 @@ void CheckJava::executeTask() { auto instance = m_parent->instance(); - auto javaPath = instance->settings()->get("JavaPath").toString(); - emit logLine("Java path is:\n" + m_javaPath + "\n\n", MessageLevel::MultiMC); + m_javaPath = instance->settings()->get("JavaPath").toString(); auto realJavaPath = QStandardPaths::findExecutable(m_javaPath); if (realJavaPath.isEmpty()) { - emit logLine(tr("The java binary \"%1\" couldn't be found. You may have to set up java " - "if Minecraft fails to launch.").arg(m_javaPath), + emit logLine(tr("The java binary \"%1\" couldn't be found. Please set up java in the settings.").arg(m_javaPath), MessageLevel::Warning); + emitFailed(tr("Java path is not valid.")); + return; + } + else + { + emit logLine("Java path is:\n" + m_javaPath + "\n\n", MessageLevel::MultiMC); } QFileInfo javaInfo(realJavaPath); @@ -47,6 +51,7 @@ void CheckJava::executeTask() connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished); m_JavaChecker->m_path = realJavaPath; m_JavaChecker->performCheck(); + return; } emitSucceeded(); } diff --git a/logic/minecraft/LegacyInstance.cpp b/logic/minecraft/LegacyInstance.cpp index 782135eb..9dd50c80 100644 --- a/logic/minecraft/LegacyInstance.cpp +++ b/logic/minecraft/LegacyInstance.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include "minecraft/ModList.h" #include @@ -136,6 +137,10 @@ std::shared_ptr LegacyInstance::createLaunchTask(AuthSessionPtr sess { process->appendStep(std::make_shared(pptr, "Minecraft folder is:\n" + minecraftRoot() + "\n\n", MessageLevel::MultiMC)); } + { + auto step = std::make_shared(pptr); + process->appendStep(step); + } // run pre-launch command if that's needed if(getPreLaunchCommand().size()) { diff --git a/logic/minecraft/OneSixInstance.cpp b/logic/minecraft/OneSixInstance.cpp index 9a7ef99b..6cea55d2 100644 --- a/logic/minecraft/OneSixInstance.cpp +++ b/logic/minecraft/OneSixInstance.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "minecraft/OneSixProfileStrategy.h" #include "MMCZip.h" @@ -243,6 +244,10 @@ std::shared_ptr OneSixInstance::createLaunchTask(AuthSessionPtr sess { process->appendStep(std::make_shared(pptr, "Minecraft folder is:\n" + minecraftRoot() + "\n\n", MessageLevel::MultiMC)); } + { + auto step = std::make_shared(pptr); + process->appendStep(step); + } // run pre-launch command if that's needed if(getPreLaunchCommand().size()) {