mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-26 17:03:08 +00:00
Apply env overrides to bootstrap process in monitored launch
This commit is contained in:
parent
56ab147a85
commit
e8626b11c1
1 changed files with 25 additions and 0 deletions
|
|
@ -1540,6 +1540,31 @@ QString GameCenterDaemon::launchMonitored(const QVariantMap &launchSpec, const Q
|
||||||
|
|
||||||
auto *bootstrap = new QProcess(this);
|
auto *bootstrap = new QProcess(this);
|
||||||
|
|
||||||
|
{
|
||||||
|
QVariant rawEnv = launchSpec.value(QStringLiteral("envOverrides"));
|
||||||
|
if (rawEnv.canConvert<QDBusVariant>()) {
|
||||||
|
rawEnv = rawEnv.value<QDBusVariant>().variant();
|
||||||
|
}
|
||||||
|
if (rawEnv.canConvert<QVariantMap>()) {
|
||||||
|
const QVariantMap bootstrapEnv = rawEnv.toMap();
|
||||||
|
if (!bootstrapEnv.isEmpty()) {
|
||||||
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
for (auto it = bootstrapEnv.constBegin(); it != bootstrapEnv.constEnd(); ++it) {
|
||||||
|
const QString key = it.key();
|
||||||
|
if (key.isEmpty() || key.contains(QLatin1Char('='))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QVariant value = it.value();
|
||||||
|
if (value.canConvert<QDBusVariant>()) {
|
||||||
|
value = value.value<QDBusVariant>().variant();
|
||||||
|
}
|
||||||
|
env.insert(key, value.toString());
|
||||||
|
}
|
||||||
|
bootstrap->setProcessEnvironment(env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
connect(bootstrap, &QProcess::errorOccurred, this, [this, sessionId, gameId, provider, command](QProcess::ProcessError error) {
|
connect(bootstrap, &QProcess::errorOccurred, this, [this, sessionId, gameId, provider, command](QProcess::ProcessError error) {
|
||||||
if (error != QProcess::FailedToStart) {
|
if (error != QProcess::FailedToStart) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue