summaryrefslogtreecommitdiffstats
path: root/api/logic/java/launch
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-06-16 02:20:23 +0200
committerPetr Mrázek <peterix@gmail.com>2016-08-01 21:15:08 +0200
commit1f2bed2ef119094bdc156aa3a206b93dea5081d1 (patch)
treef154e39d3de3a3d71ed868cf396c4361b04e75c5 /api/logic/java/launch
parent57c84ec2b15d8aa6985681f79641f5989c2f049f (diff)
downloadMultiMC-1f2bed2ef119094bdc156aa3a206b93dea5081d1.tar
MultiMC-1f2bed2ef119094bdc156aa3a206b93dea5081d1.tar.gz
MultiMC-1f2bed2ef119094bdc156aa3a206b93dea5081d1.tar.lz
MultiMC-1f2bed2ef119094bdc156aa3a206b93dea5081d1.tar.xz
MultiMC-1f2bed2ef119094bdc156aa3a206b93dea5081d1.zip
NOISSUE implement direct java launch
Just running the Java process and giving it params on the command line
Diffstat (limited to 'api/logic/java/launch')
-rw-r--r--api/logic/java/launch/CheckJava.cpp26
-rw-r--r--api/logic/java/launch/CheckJava.h3
2 files changed, 21 insertions, 8 deletions
diff --git a/api/logic/java/launch/CheckJava.cpp b/api/logic/java/launch/CheckJava.cpp
index a4eaa307..41bb6398 100644
--- a/api/logic/java/launch/CheckJava.cpp
+++ b/api/logic/java/launch/CheckJava.cpp
@@ -53,20 +53,25 @@ void CheckJava::executeTask()
QFileInfo javaInfo(realJavaPath);
qlonglong javaUnixTime = javaInfo.lastModified().toMSecsSinceEpoch();
auto storedUnixTime = settings->get("JavaTimestamp").toLongLong();
+ auto storedArchitecture = settings->get("JavaArchitecture").toString();
+ auto storedVersion = settings->get("JavaVersion").toString();
m_javaUnixTime = javaUnixTime;
- // if they are not the same, check!
- if (javaUnixTime != storedUnixTime)
+ // if timestamps are not the same, or something is missing, check!
+ if (javaUnixTime != storedUnixTime || storedVersion.size() == 0 || storedArchitecture.size() == 0)
{
m_JavaChecker = std::make_shared<JavaChecker>();
- QString errorLog;
- QString version;
emit logLine(tr("Checking Java version..."), MessageLevel::MultiMC);
- connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this,
- &CheckJava::checkJavaFinished);
+ connect(m_JavaChecker.get(), &JavaChecker::checkFinished, this, &CheckJava::checkJavaFinished);
m_JavaChecker->m_path = realJavaPath;
m_JavaChecker->performCheck();
return;
}
+ else
+ {
+ auto verString = instance->settings()->get("JavaVersion").toString();
+ auto archString = instance->settings()->get("JavaArchitecture").toString();
+ printJavaInfo(verString, archString);
+ }
emitSucceeded();
}
@@ -83,10 +88,15 @@ void CheckJava::checkJavaFinished(JavaCheckResult result)
else
{
auto instance = m_parent->instance();
- emit logLine(tr("Java version is %1!\n").arg(result.javaVersion.toString()),
- MessageLevel::MultiMC);
+ printJavaInfo(result.javaVersion.toString(), result.mojangPlatform);
instance->settings()->set("JavaVersion", result.javaVersion.toString());
+ instance->settings()->set("JavaArchitecture", result.mojangPlatform);
instance->settings()->set("JavaTimestamp", m_javaUnixTime);
emitSucceeded();
}
}
+
+void CheckJava::printJavaInfo(const QString& version, const QString& architecture)
+{
+ emit logLine(tr("Java is version %1, using %2-bit architecture.\n\n").arg(version, architecture), MessageLevel::MultiMC);
+}
diff --git a/api/logic/java/launch/CheckJava.h b/api/logic/java/launch/CheckJava.h
index b63dd4f4..118da225 100644
--- a/api/logic/java/launch/CheckJava.h
+++ b/api/logic/java/launch/CheckJava.h
@@ -35,6 +35,9 @@ private slots:
void checkJavaFinished(JavaCheckResult result);
private:
+ void printJavaInfo(const QString & version, const QString & architecture);
+
+private:
QString m_javaPath;
qlonglong m_javaUnixTime;
JavaCheckerPtr m_JavaChecker;