1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 20:47:45 +00:00

Use KSandbox to wrap in flatpak host spawn if needed

This commit is contained in:
Joshua Goins 2023-12-17 13:00:24 -05:00
parent 40a762cead
commit 68f76f63d4

View file

@ -3,6 +3,8 @@
#include "gamerunner.h"
#include <KSandbox>
#ifdef ENABLE_GAMEMODE
#include <gamemode_client.h>
#endif
@ -283,10 +285,6 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
env.insert(QStringLiteral("MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS"), QString::number(1));
}
#if defined(FLATPAK)
arguments.push_back(QStringLiteral("flatpak-spawn"));
arguments.push_back(QStringLiteral("--host"));
#endif
arguments.push_back(profile.winePath());
}
#endif
@ -301,7 +299,13 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con
process->setProcessEnvironment(env);
process->start(executable, arguments);
// Wrap in flatpak host spawn if needed
if (KSandbox::isInside()) {
const auto context = KSandbox::makeHostContext(*process);
process->start(context.program, context.arguments);
} else {
process->start(executable, arguments);
}
}
void GameRunner::addRegistryKey(const Profile &settings, QString key, QString value, QString data)