Print custom environment variables during instance launch (#4832)
This commit is contained in:
@@ -683,12 +683,7 @@ QProcessEnvironment MinecraftInstance::createEnvironment()
|
||||
env.insert(iter.key(), iter.value().toString());
|
||||
};
|
||||
|
||||
bool overrideEnv = settings()->get("OverrideEnv").toBool();
|
||||
|
||||
if (!overrideEnv)
|
||||
insertEnv(APPLICATION->settings()->get("Env").toString());
|
||||
else
|
||||
insertEnv(settings()->get("Env").toString());
|
||||
insertEnv(settings()->get("Env").toString());
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -888,9 +883,13 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftT
|
||||
|
||||
QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin)
|
||||
{
|
||||
constexpr auto indent = " ";
|
||||
constexpr auto emptyLine = "";
|
||||
|
||||
QStringList out;
|
||||
out << "Main Class:" << " " + getMainClass() << "";
|
||||
out << "Native path:" << " " + getNativePath() << "";
|
||||
|
||||
out << "Main Class:" << indent + getMainClass() << emptyLine;
|
||||
out << "Native path:" << indent + getNativePath() << emptyLine;
|
||||
|
||||
auto profile = m_components->getProfile();
|
||||
|
||||
@@ -899,9 +898,9 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
if (alltraits.size()) {
|
||||
out << "Traits:";
|
||||
for (auto trait : alltraits) {
|
||||
out << "traits " + trait;
|
||||
out << indent + trait;
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
}
|
||||
|
||||
// native libraries
|
||||
@@ -913,7 +912,7 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
out << "Using system OpenAL.";
|
||||
if (nativeGLFW)
|
||||
out << "Using system GLFW.";
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
}
|
||||
|
||||
// libraries and class path.
|
||||
@@ -924,20 +923,20 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
auto printLibFile = [&out](const QString& path) {
|
||||
QFileInfo info(path);
|
||||
if (info.exists()) {
|
||||
out << " " + path;
|
||||
out << indent + path;
|
||||
} else {
|
||||
out << " " + path + " (missing)";
|
||||
out << indent + path + " (missing)";
|
||||
}
|
||||
};
|
||||
for (auto file : jars) {
|
||||
printLibFile(file);
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
out << "Native libraries:";
|
||||
for (auto file : nativeJars) {
|
||||
printLibFile(file);
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
}
|
||||
|
||||
// mods and core mods
|
||||
@@ -962,7 +961,7 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
out << u8" [✘] " + mod->fileinfo().completeBaseName() + " (disabled)";
|
||||
}
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -977,19 +976,19 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
auto displayname = jarmod->displayName(runtimeContext());
|
||||
auto realname = jarmod->filename(runtimeContext());
|
||||
if (displayname != realname) {
|
||||
out << " " + displayname + " (" + realname + ")";
|
||||
out << indent + displayname + " (" + realname + ")";
|
||||
} else {
|
||||
out << " " + realname;
|
||||
out << indent + realname;
|
||||
}
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
}
|
||||
|
||||
// minecraft arguments
|
||||
auto params = processMinecraftArgs(nullptr, targetToJoin);
|
||||
out << "Params:";
|
||||
out << " " + params.join(' ');
|
||||
out << "";
|
||||
out << indent + params.join(' ');
|
||||
out << emptyLine;
|
||||
|
||||
// window size
|
||||
QString windowParams;
|
||||
@@ -1000,9 +999,21 @@ QStringList MinecraftInstance::verboseDescription(AuthSessionPtr session, Minecr
|
||||
auto height = settings->get("MinecraftWinHeight").toInt();
|
||||
out << "Window size: " + QString::number(width) + " x " + QString::number(height);
|
||||
}
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
|
||||
out << "Launcher: " + getLauncher();
|
||||
out << "";
|
||||
out << emptyLine;
|
||||
|
||||
// environment variables
|
||||
const QString env = settings->get("Env").toString();
|
||||
if (auto envMap = Json::toMap(env); !envMap.isEmpty()) {
|
||||
out << "Custom environment variables:";
|
||||
for (auto [key, value] : envMap.asKeyValueRange()) {
|
||||
out << indent + key + "=" + value.toString();
|
||||
}
|
||||
out << emptyLine;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user