diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-11-01 14:11:20 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-11-01 14:11:20 +0100 |
commit | 3d1426b5592794160188878927ff2eefc56b0211 (patch) | |
tree | 4d0eb83584bf3445a60a184321d296a99199375a /logic | |
parent | 095640ed01295f61d4ac6c38637e57534083667d (diff) | |
download | MultiMC-3d1426b5592794160188878927ff2eefc56b0211.tar MultiMC-3d1426b5592794160188878927ff2eefc56b0211.tar.gz MultiMC-3d1426b5592794160188878927ff2eefc56b0211.tar.lz MultiMC-3d1426b5592794160188878927ff2eefc56b0211.tar.xz MultiMC-3d1426b5592794160188878927ff2eefc56b0211.zip |
Filter env variables passed to Minecraft
QT_* and LD_* are not passed through
env variables are logged on launch
Diffstat (limited to 'logic')
-rw-r--r-- | logic/MinecraftProcess.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index 1a7dc2fe..71bf34c7 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -41,14 +41,37 @@ MinecraftProcess::MinecraftProcess(InstancePtr inst) : m_instance(inst) SLOT(finish(int, QProcess::ExitStatus))); // prepare the process environment - QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QProcessEnvironment rawenv = QProcessEnvironment::systemEnvironment(); + QProcessEnvironment env; + for(auto key: rawenv.keys()) + { + auto value = rawenv.value(key); + // filter MultiMC-related things + if(key.startsWith("QT_")) + { + QLOG_INFO() << "Env: ignoring" << key << value; + continue; + } #ifdef LINUX - // Strip IBus - // IBus is a Linux IME framework. For some reason, it breaks MC? - if (env.value("XMODIFIERS").contains(IBUS)) - env.insert("XMODIFIERS", env.value("XMODIFIERS").replace(IBUS, "")); + // Do not pass LD_* variables to java. They were intended for MultiMC + if(key.startsWith("LD_")) + { + QLOG_INFO() << "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, ""); + QLOG_INFO() << "Env: stripped" << IBUS << "from" << save << ":" << value; + } #endif + QLOG_INFO() << "Env: " << key << value; + env.insert(key, value); + } // export some infos auto variables = getVariables(); |