diff options
author | Joona <joonatoona@digitalfishfun.com> | 2017-08-22 15:23:35 -0700 |
---|---|---|
committer | Joona <joonatoona@digitalfishfun.com> | 2017-08-22 15:23:35 -0700 |
commit | 48274e889f2219545d2c3bea6cc3a0281e9a0c47 (patch) | |
tree | 0178e8464c04df3d01b7d744848aef4acf7b933d /api/logic/minecraft | |
parent | 9d3a84755517cbcf14cd07d2148cd416e38ea430 (diff) | |
download | PrismLauncher-48274e889f2219545d2c3bea6cc3a0281e9a0c47.tar.gz PrismLauncher-48274e889f2219545d2c3bea6cc3a0281e9a0c47.tar.bz2 PrismLauncher-48274e889f2219545d2c3bea6cc3a0281e9a0c47.zip |
move env cleaning and clean before java test
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r-- | api/logic/minecraft/MinecraftInstance.cpp | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index cb080bfe..785ddb38 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -20,6 +20,7 @@ #include "minecraft/launch/ModMinecraftJar.h" #include "minecraft/launch/ClaimAccount.h" #include "java/launch/CheckJava.h" +#include "java/JavaUtils.h" #include <meta/Index.h> #include <meta/VersionList.h> @@ -181,71 +182,7 @@ static QString processLD_LIBRARY_PATH(const QString & LD_LIBRARY_PATH) QProcessEnvironment MinecraftInstance::createEnvironment() { // prepare the process environment - QProcessEnvironment rawenv = QProcessEnvironment::systemEnvironment(); - QProcessEnvironment env; - - QStringList ignored = - { - "JAVA_ARGS", - "CLASSPATH", - "CONFIGPATH", - "JAVA_HOME", - "JRE_HOME", - "_JAVA_OPTIONS", - "JAVA_OPTIONS", - "JAVA_TOOL_OPTIONS" - }; - for(auto key: rawenv.keys()) - { - auto value = rawenv.value(key); - // filter out dangerous java crap - if(ignored.contains(key)) - { - qDebug() << "Env: ignoring" << key << value; - continue; - } - // filter MultiMC-related things - if(key.startsWith("QT_")) - { - qDebug() << "Env: ignoring" << key << value; - continue; - } -#ifdef Q_OS_LINUX - // Do not pass LD_* variables to java. They were intended for MultiMC - if(key.startsWith("LD_")) - { - qDebug() << "Env: ignoring" << key << value; - continue; - } - // Strip IBus - // IBus is a Linux IME framework. For some reason, it breaks MC? - if (key == "XMODIFIERS" && value.contains(IBUS)) - { - QString save = value; - value.replace(IBUS, ""); - qDebug() << "Env: stripped" << IBUS << "from" << save << ":" << value; - } - if(key == "GAME_PRELOAD") - { - env.insert("LD_PRELOAD", value); - continue; - } - if(key == "GAME_LIBRARY_PATH") - { - env.insert("LD_LIBRARY_PATH", processLD_LIBRARY_PATH(value)); - continue; - } -#endif - qDebug() << "Env: " << key << value; - env.insert(key, value); - } -#ifdef Q_OS_LINUX - // HACK: Workaround for QTBUG42500 - if(!env.contains("LD_LIBRARY_PATH")) - { - env.insert("LD_LIBRARY_PATH", ""); - } -#endif + QProcessEnvironment env = CleanEnviroment(); // export some infos auto variables = getVariables(); |