summaryrefslogtreecommitdiffstats
path: root/MultiMC.cpp
diff options
context:
space:
mode:
authorSky <git@bunnies.cc>2013-10-06 23:44:34 +0100
committerSky <git@bunnies.cc>2013-10-06 23:44:34 +0100
commit58547d38673c458cf5be44909551b42497e263b7 (patch)
treedfe549d3482427e6200a5aa9b369de3aefdc9d73 /MultiMC.cpp
parent8450807c06b3831dfb4279529e93db9444a9e612 (diff)
downloadMultiMC-58547d38673c458cf5be44909551b42497e263b7.tar
MultiMC-58547d38673c458cf5be44909551b42497e263b7.tar.gz
MultiMC-58547d38673c458cf5be44909551b42497e263b7.tar.lz
MultiMC-58547d38673c458cf5be44909551b42497e263b7.tar.xz
MultiMC-58547d38673c458cf5be44909551b42497e263b7.zip
Automatically try to set the Java path on first start
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index ef720c33..be1b86da 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -16,6 +16,8 @@
#include "logic/InstanceLauncher.h"
#include "logic/net/HttpMetaCache.h"
+#include "logic/JavaUtils.h"
+
#include "pathutils.h"
#include "cmdutils.h"
#include <inisettingsobject.h>
@@ -260,7 +262,18 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting(new Setting("PermGen", 64));
// Java Settings
- m_settings->registerSetting(new Setting("JavaPath", "java"));
+ m_settings->registerSetting(new Setting("JavaPath", ""));
+ QString currentJavaPath = m_settings->get("JavaPath").toString();
+ if(currentJavaPath.isEmpty())
+ {
+ QLOG_INFO() << "Java path not set, attempting to set it automatically...";
+
+ JavaUtils jut;
+ auto javas = jut.FindJavaPaths();
+
+ m_settings->set("JavaPath", std::get<JI_PATH>(javas.at(0)));
+ }
+
m_settings->registerSetting(new Setting("JvmArgs", ""));
// Custom Commands