Commit 0e5f2275 authored by Hannah von Reth's avatar Hannah von Reth

Also detect applications in the binary directory

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: #kde_pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D11154
parent 1d53b111
......@@ -539,7 +539,7 @@ void AgentManager::readPluginInfos(const QDir &directory)
}
if (agentInfo.launchMethod == AgentType::Process) {
const QString executable = QStandardPaths::findExecutable(agentInfo.exec);
const QString executable = Akonadi::StandardDirs::findExecutable(agentInfo.exec);
if (executable.isEmpty()) {
qCWarning(AKONADICONTROL_LOG) << "Executable" << agentInfo.exec << "for agent" << agentInfo.identifier << "could not be found!";
continue;
......
......@@ -22,6 +22,7 @@
#include "agenttype.h"
#include "processcontrol.h"
#include "akonadicontrol_debug.h"
#include "private/standarddirs_p.h"
#include <QStandardPaths>
......@@ -45,7 +46,7 @@ bool AgentProcessInstance::start(const AgentType &agentInfo)
agentInfo.launchMethod == AgentType::Launcher);
const QString executable = (agentInfo.launchMethod == AgentType::Process)
? QStandardPaths::findExecutable(agentInfo.exec) : agentInfo.exec;
? Akonadi::StandardDirs::findExecutable(agentInfo.exec) : agentInfo.exec;
if (executable.isEmpty()) {
qCWarning(AKONADICONTROL_LOG) << "Unable to find agent executable" << agentInfo.exec;
......@@ -61,7 +62,7 @@ bool AgentProcessInstance::start(const AgentType &agentInfo)
} else {
Q_ASSERT(agentInfo.launchMethod == AgentType::Launcher);
const QStringList arguments = QStringList() << executable << identifier();
const QString agentLauncherExec = QStandardPaths::findExecutable(QStringLiteral("akonadi_agent_launcher"));
const QString agentLauncherExec = Akonadi::StandardDirs::findExecutable(QStringLiteral("akonadi_agent_launcher"));
mController->start(agentLauncherExec, arguments);
}
return true;
......
......@@ -22,6 +22,7 @@
#include "instance_p.h"
#include "akonadi-prefix.h"
#include <QCoreApplication>
#include <QStandardPaths>
#include <QFile>
#include <QFileInfo>
......@@ -186,3 +187,12 @@ QStringList StandardDirs::locateAllResourceDirs(const QString &relPath)
}
return dirs;
}
QString StandardDirs::findExecutable(const QString &executableName)
{
QString executable = QStandardPaths::findExecutable(executableName, {qApp->applicationDirPath()});
if (executable.isEmpty()) {
executable = QStandardPaths::findExecutable(executableName);
}
return executable;
}
......@@ -104,6 +104,13 @@ AKONADIPRIVATE_EXPORT QString locateResourceFile(const char *resource, const QSt
*/
AKONADIPRIVATE_EXPORT QStringList locateAllResourceDirs(const QString &relPath);
/**
* Equivalent to QStandardPaths::findExecutable() but it looks in
* qApp->applicationDirPath() first.
*/
AKONADIPRIVATE_EXPORT QString findExecutable(const QString &relPath);
}
}
......
......@@ -393,7 +393,7 @@ void SelfTestDialog::testPSQLServer()
void SelfTestDialog::testAkonadiCtl()
{
const QString path = QStandardPaths::findExecutable(QStringLiteral("akonadictl"));
const QString path = Akonadi::StandardDirs::findExecutable(QStringLiteral("akonadictl"));
if (path.isEmpty()) {
report(Error, ki18n("akonadictl not found"),
ki18n("The program 'akonadictl' needs to be accessible in $PATH. "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment