From 74f8da1cd43f94996753985580728d15f19c86c2 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 29 Apr 2021 08:18:47 +0200 Subject: [PATCH] ProjectExplorer: Add ProjectConfiguration::mapFromBuildDeviceToGlobalPath A convenience function to help making buildsteps etc. work with container setups. Change-Id: I0aca129ee0ed4eb70c7ec9dcebead42b73651dc3 Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/projectconfiguration.cpp | 10 ++++++++++ src/plugins/projectexplorer/projectconfiguration.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp index 464d3ba5c19..92e77dc89f8 100644 --- a/src/plugins/projectexplorer/projectconfiguration.cpp +++ b/src/plugins/projectexplorer/projectconfiguration.cpp @@ -24,6 +24,8 @@ ****************************************************************************/ #include "projectconfiguration.h" + +#include "kitinformation.h" #include "target.h" #include @@ -33,6 +35,7 @@ #include using namespace ProjectExplorer; +using namespace Utils; const char CONFIGURATION_ID_KEY[] = "ProjectExplorer.ProjectConfiguration.Id"; const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ProjectConfiguration.DisplayName"; @@ -142,6 +145,13 @@ void ProjectConfiguration::acquaintAspects() aspect->acquaintSiblings(m_aspects); } +FilePath ProjectConfiguration::mapFromBuildDeviceToGlobalPath(const FilePath &path) const +{ + IDevice::ConstPtr dev = BuildDeviceKitAspect::device(kit()); + QTC_ASSERT(dev, return path); + return dev->mapToGlobalPath(path); +} + Utils::Id ProjectExplorer::idFromMap(const QVariantMap &map) { return Utils::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY))); diff --git a/src/plugins/projectexplorer/projectconfiguration.h b/src/plugins/projectexplorer/projectconfiguration.h index 20200daa82f..a6d17329739 100644 --- a/src/plugins/projectexplorer/projectconfiguration.h +++ b/src/plugins/projectexplorer/projectconfiguration.h @@ -89,6 +89,8 @@ public: void acquaintAspects(); + Utils::FilePath mapFromBuildDeviceToGlobalPath(const Utils::FilePath &path) const; + signals: void displayNameChanged(); void toolTipChanged();