Start xclipboard sync process from build dir if available

Summary:
The xclipboard sync test times out on build.kde.org as KWin is not
installed prior to running the tests. This is due to KWin not finding
the executable for the clipboard sync helper.

This change looks whether the binary exists in the same directory as
KWin's executable. If it exists it is started instead of the hardcoded
path in libexec.

Test Plan: Run the test and verified the correct binary is loaded

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16732
This commit is contained in:
Martin Flöser 2018-11-07 12:49:09 +01:00
parent f27f8a267f
commit 7221864cd2

View file

@ -63,6 +63,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt
#include <QDir>
#include <QFileInfo>
#include <QThread>
#include <QWindow>
@ -590,7 +592,13 @@ void WaylandServer::setupX11ClipboardSync()
}
);
m_xclipbaordSync.process->setProcessEnvironment(environment);
m_xclipbaordSync.process->start(QStringLiteral(KWIN_XCLIPBOARD_SYNC_BIN));
// start from build directory if executable is available there (e.g. autotests), otherwise start libexec executable
const QFileInfo clipboardSync{QDir{QCoreApplication::applicationDirPath()}, QStringLiteral("org_kde_kwin_xclipboard_syncer")};
if (clipboardSync.exists()) {
m_xclipbaordSync.process->start(clipboardSync.absoluteFilePath());
} else {
m_xclipbaordSync.process->start(QStringLiteral(KWIN_XCLIPBOARD_SYNC_BIN));
}
}
}