GH-1355 do not allow setting LD_LIBRARY_PATh for Minecraft to the MultiMC bin folder
This commit is contained in:
parent
2db4a595dd
commit
478ff11485
@ -132,6 +132,24 @@ QMap<QString, QString> MinecraftInstance::getVariables() const
|
||||
return out;
|
||||
}
|
||||
|
||||
static QString processLD_LIBRARY_PATH(const QString & LD_LIBRARY_PATH)
|
||||
{
|
||||
QDir mmcBin(QCoreApplication::applicationDirPath());
|
||||
auto items = LD_LIBRARY_PATH.split(':');
|
||||
QStringList final;
|
||||
for(auto & item: items)
|
||||
{
|
||||
QDir test(item);
|
||||
if(test == mmcBin)
|
||||
{
|
||||
qDebug() << "Env:LD_LIBRARY_PATH ignoring path" << item;
|
||||
continue;
|
||||
}
|
||||
final.append(item);
|
||||
}
|
||||
return final.join(':');
|
||||
}
|
||||
|
||||
QProcessEnvironment MinecraftInstance::createEnvironment()
|
||||
{
|
||||
// prepare the process environment
|
||||
@ -186,7 +204,7 @@ QProcessEnvironment MinecraftInstance::createEnvironment()
|
||||
}
|
||||
if(key == "GAME_LIBRARY_PATH")
|
||||
{
|
||||
env.insert("LD_LIBRARY_PATH", value);
|
||||
env.insert("LD_LIBRARY_PATH", processLD_LIBRARY_PATH(value));
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user