summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-12-18 05:43:44 +0100
committerPetr Mrázek <peterix@gmail.com>2015-12-18 05:43:44 +0100
commit478ff1148599ce6dd650d310a7bb4140b640cb30 (patch)
tree0d3adfc43052f76f6a33c6d98ca4ac7954973d15
parent2db4a595dd13c16f8fee8c6f67d75a7ef10d2f30 (diff)
downloadMultiMC-478ff1148599ce6dd650d310a7bb4140b640cb30.tar
MultiMC-478ff1148599ce6dd650d310a7bb4140b640cb30.tar.gz
MultiMC-478ff1148599ce6dd650d310a7bb4140b640cb30.tar.lz
MultiMC-478ff1148599ce6dd650d310a7bb4140b640cb30.tar.xz
MultiMC-478ff1148599ce6dd650d310a7bb4140b640cb30.zip
GH-1355 do not allow setting LD_LIBRARY_PATh for Minecraft to the MultiMC bin folder
-rw-r--r--logic/minecraft/MinecraftInstance.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/logic/minecraft/MinecraftInstance.cpp b/logic/minecraft/MinecraftInstance.cpp
index 0dab4dfe..05dedf1d 100644
--- a/logic/minecraft/MinecraftInstance.cpp
+++ b/logic/minecraft/MinecraftInstance.cpp
@@ -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