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
|
class PROJECTEXPLORER_EXPORT BuildTargetInfoList
|
||||||
{
|
{
|
||||||
public:
|
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) {
|
BuildTargetInfo buildTargetInfo(const QString &buildKey) {
|
||||||
return Utils::findOrDefault(list, [&buildKey](const BuildTargetInfo &ti) {
|
return Utils::findOrDefault(list, [&buildKey](const BuildTargetInfo &ti) {
|
||||||
return ti.buildKey == buildKey;
|
return ti.buildKey == buildKey;
|
||||||
|
@@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
using namespace WinRt;
|
using namespace WinRt;
|
||||||
using namespace WinRt::Internal;
|
using namespace WinRt::Internal;
|
||||||
|
|
||||||
@@ -66,11 +68,12 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &proFile = runConfiguration->proFilePath();
|
const BuildTargetInfo bti = target->applicationTargets().buildTargetInfo(runConfiguration->buildKey());
|
||||||
m_executableFilePath = target->applicationTargets().targetForProject(proFile).toString();
|
m_executableFilePath = bti.targetFilePath.toString();
|
||||||
|
|
||||||
if (m_executableFilePath.isEmpty()) {
|
if (m_executableFilePath.isEmpty()) {
|
||||||
*errorMessage = tr("Cannot determine the executable file path for \"%1\".").arg(
|
*errorMessage = tr("Cannot determine the executable file path for \"%1\".").arg(
|
||||||
QDir::toNativeSeparators(proFile));
|
QDir::toNativeSeparators(bti.projectFilePath.toString()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user