diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2017-08-13 08:54:51 +0200 |
---|---|---|
committer | Holger Freyther <holger+qt@freyther.de> | 2017-09-12 06:16:43 +0000 |
commit | e1c257c3330057d7df70d3a1e92361afcdd06579 (patch) | |
tree | 35edb25fd5acfb9e93ee017142cacffcd6999e27 /wayland/democompositor/processlauncher.cpp | |
parent | 5b64a6d44215a22ffa9a4d7b64b695ffe9dfa858 (diff) |
democompositor: Move to start by AppEntry
The AppEntry contains the executable name and the $PATH to use.
Store a copy of the AppEntry and pass it to the processlauncher.
Change-Id: I15792cc7ce651beed2006841c100b31d3252d9d1
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'wayland/democompositor/processlauncher.cpp')
-rw-r--r-- | wayland/democompositor/processlauncher.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/wayland/democompositor/processlauncher.cpp b/wayland/democompositor/processlauncher.cpp index a25fbd5..f0e465e 100644 --- a/wayland/democompositor/processlauncher.cpp +++ b/wayland/democompositor/processlauncher.cpp @@ -49,9 +49,12 @@ ****************************************************************************/ #include "processlauncher.h" +#include "apps/appentry.h" #include <QProcess> +Q_LOGGING_CATEGORY(procs, "launcher.procs") + WaylandProcessLauncher::WaylandProcessLauncher(QObject *parent) : QObject(parent) { @@ -61,16 +64,22 @@ WaylandProcessLauncher::~WaylandProcessLauncher() { } -void WaylandProcessLauncher::launch(const QString &program) +void WaylandProcessLauncher::launch(const AppEntry &entry) { + qCDebug(procs) << "Launching" << entry.executableName; + QProcess *process = new QProcess(this); connect(process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), process, &QProcess::deleteLater); connect(process, &QProcess::errorOccurred, &QProcess::deleteLater); + if (!entry.executablePath.isNull()) { + auto env = QProcessEnvironment::systemEnvironment(); + env.insert(QStringLiteral("PATH"), entry.executablePath); + process->setProcessEnvironment(env); + } + QStringList arguments; arguments << "-platform" << "wayland"; - process->start(program, arguments); - + process->start(entry.executableName, arguments); } - |