Filter env variables passed to Minecraft
QT_* and LD_* are not passed through env variables are logged on launch
This commit is contained in:
parent
095640ed01
commit
3d1426b559
@ -41,14 +41,37 @@ MinecraftProcess::MinecraftProcess(InstancePtr inst) : m_instance(inst)
|
|||||||
SLOT(finish(int, QProcess::ExitStatus)));
|
SLOT(finish(int, QProcess::ExitStatus)));
|
||||||
|
|
||||||
// prepare the process environment
|
// 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
|
#ifdef LINUX
|
||||||
// Strip IBus
|
// Do not pass LD_* variables to java. They were intended for MultiMC
|
||||||
// IBus is a Linux IME framework. For some reason, it breaks MC?
|
if(key.startsWith("LD_"))
|
||||||
if (env.value("XMODIFIERS").contains(IBUS))
|
{
|
||||||
env.insert("XMODIFIERS", env.value("XMODIFIERS").replace(IBUS, ""));
|
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
|
#endif
|
||||||
|
QLOG_INFO() << "Env: " << key << value;
|
||||||
|
env.insert(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
// export some infos
|
// export some infos
|
||||||
auto variables = getVariables();
|
auto variables = getVariables();
|
||||||
|
Loading…
Reference in New Issue
Block a user