diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 4b700e89a21..eebd7c91ed1 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -44,6 +44,7 @@ #include "projectexplorersettingspage.h" #include "projectmanager.h" #include "removetaskhandler.h" +#include "runconfigurationaspects.h" #include "kitfeatureprovider.h" #include "kitmanager.h" #include "kitoptionspage.h" @@ -1586,8 +1587,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er tr("The currently active run configuration's executable (if applicable)."), []() -> QString { if (Target *target = activeTarget()) { - if (RunConfiguration *rc = target->activeRunConfiguration()) - return rc->runnable().executable; + if (RunConfiguration *rc = target->activeRunConfiguration()) { + // TODO: This duplicates code and is not always correct, but see + // QTCREATORBUG-18317. + // Solution: Re-introduce RunConfiguration::executable()? + if (auto executableAspect = rc->aspect()) + return executableAspect->executable().toString(); + return QString(); + } } return QString(); });