From adaf1b3826391945cb52e693c80e564b7a93a6ac Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 26 Apr 2018 18:00:17 +0200 Subject: [PATCH] WinRt: Generalize executable extraction in WinRtRunnerHelper This was the only remaining user of ProjectExplorer:: BuildTargetInfoLists::targetForProject was only. The result after direct inlining shows that it relies on the qmake-centered assumption that the the .pro file name is used as build key in BuildTargetInfoLists, so replace it with the now-generic projectFilePath member instead. Change-Id: Ic4dccfb347289a3dcbb4c6a11b71cf568b054fd8 Reviewed-by: David Schulz --- src/plugins/projectexplorer/buildtargetinfo.h | 14 -------------- src/plugins/winrt/winrtrunnerhelper.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/plugins/projectexplorer/buildtargetinfo.h b/src/plugins/projectexplorer/buildtargetinfo.h index f0f4e4f2916..1da61b7d0f1 100644 --- a/src/plugins/projectexplorer/buildtargetinfo.h +++ b/src/plugins/projectexplorer/buildtargetinfo.h @@ -72,20 +72,6 @@ inline uint qHash(const BuildTargetInfo &ti) class PROJECTEXPLORER_EXPORT BuildTargetInfoList { public: - Utils::FileName targetForProject(const QString &projectFilePath) const - { - return targetForProject(Utils::FileName::fromString(projectFilePath)); - } - - Utils::FileName targetForProject(const Utils::FileName &projectFilePath) const - { - foreach (const BuildTargetInfo &ti, list) { - if (ti.projectFilePath == projectFilePath) - return ti.targetFilePath; - } - return Utils::FileName(); - } - BuildTargetInfo buildTargetInfo(const QString &buildKey) { return Utils::findOrDefault(list, [&buildKey](const BuildTargetInfo &ti) { return ti.buildKey == buildKey; diff --git a/src/plugins/winrt/winrtrunnerhelper.cpp b/src/plugins/winrt/winrtrunnerhelper.cpp index 3b23a875f02..0c6abf6be2f 100644 --- a/src/plugins/winrt/winrtrunnerhelper.cpp +++ b/src/plugins/winrt/winrtrunnerhelper.cpp @@ -41,6 +41,8 @@ #include +using namespace ProjectExplorer; + using namespace WinRt; using namespace WinRt::Internal; @@ -66,11 +68,12 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr return; } - const QString &proFile = runConfiguration->proFilePath(); - m_executableFilePath = target->applicationTargets().targetForProject(proFile).toString(); + const BuildTargetInfo bti = target->applicationTargets().buildTargetInfo(runConfiguration->buildKey()); + m_executableFilePath = bti.targetFilePath.toString(); + if (m_executableFilePath.isEmpty()) { *errorMessage = tr("Cannot determine the executable file path for \"%1\".").arg( - QDir::toNativeSeparators(proFile)); + QDir::toNativeSeparators(bti.projectFilePath.toString())); return; }