From c82e3cf6a8f9ec0e8e60da7f5f66d91cac4520ab Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 25 Oct 2021 18:16:27 +0200 Subject: [PATCH] Utils: Map local path path in FilePath::onDevice(), too To cover cases like Windows -> Docker/Linux, where these parts are not an exact 1:1 mapping. Change-Id: Iecc26e06771fb190644988950271ff7990962b6b Reviewed-by: hjk --- src/libs/utils/filepath.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 065f96809e9..dadf791a61e 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -1182,10 +1182,16 @@ QString FilePath::calcRelativePath(const QString &absolutePath, const QString &a */ FilePath FilePath::onDevice(const FilePath &deviceTemplate) const { + if (!deviceTemplate.needsDevice()) + return mapToGlobalPath(); + const bool sameDevice = m_scheme == deviceTemplate.m_scheme && m_host == deviceTemplate.m_host; + // TODO: converting paths between different non local devices is still unsupported + QTC_CHECK(!needsDevice() || sameDevice); FilePath res; - res.m_data = m_data; - res.m_host = deviceTemplate.m_host; res.m_scheme = deviceTemplate.m_scheme; + res.m_host = deviceTemplate.m_host; + res.m_data = m_data; + res.m_data = res.mapToDevicePath(); return res; }