forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user