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 <david.schulz@qt.io>
This commit is contained in:
hjk
2018-04-26 18:00:17 +02:00
parent eca2f5da53
commit adaf1b3826
2 changed files with 6 additions and 17 deletions

View File

@@ -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;

View File

@@ -41,6 +41,8 @@
#include <QDir>
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;
}