diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 827d6164edc..c37e2d106e2 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -773,17 +773,11 @@ bool DockerDevice::usableAsBuildDevice() const return true; } -FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const +FilePath DockerDevice::filePath(const QString &pathOnDevice) const { - if (pathOnDevice.needsDevice()) { - // Already correct form, only sanity check it's ours... - QTC_CHECK(handlesFile(pathOnDevice)); - return pathOnDevice; - } - return FilePath::fromParts(Constants::DOCKER_DEVICE_SCHEME, d->repoAndTagEncoded(), - pathOnDevice.path()); + pathOnDevice); // The following would work, but gives no hint on repo and tag // result.setScheme("docker"); diff --git a/src/plugins/docker/dockerdevice.h b/src/plugins/docker/dockerdevice.h index cedb045205f..4c5cd20e921 100644 --- a/src/plugins/docker/dockerdevice.h +++ b/src/plugins/docker/dockerdevice.h @@ -81,9 +81,8 @@ public: ProjectExplorer::DeviceTester *createDeviceTester() const override; bool usableAsBuildDevice() const override; - Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; - Utils::FilePath rootPath() const override; + Utils::FilePath filePath(const QString &pathOnDevice) const override; bool handlesFile(const Utils::FilePath &filePath) const override; bool ensureReachable(const Utils::FilePath &other) const override; diff --git a/src/plugins/docker/dockerdevicewidget.cpp b/src/plugins/docker/dockerdevicewidget.cpp index d27bdb03fb2..8e385777e53 100644 --- a/src/plugins/docker/dockerdevicewidget.cpp +++ b/src/plugins/docker/dockerdevicewidget.cpp @@ -167,7 +167,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device) paths.append(FilePath::fromString(path.trimmed())); } paths = Utils::transform(paths, [dockerDevice](const FilePath &path) { - return dockerDevice->mapToGlobalPath(path); + return dockerDevice->filePath(path.path()); }); return paths; }; diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 2d3465b6b2e..3eb879adb7d 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -139,10 +139,9 @@ bool DesktopDevice::handlesFile(const FilePath &filePath) const return !filePath.needsDevice(); } -FilePath DesktopDevice::mapToGlobalPath(const Utils::FilePath &pathOnDevice) const +FilePath DesktopDevice::filePath(const QString &pathOnDevice) const { - QTC_CHECK(!pathOnDevice.needsDevice()); - return pathOnDevice; + return FilePath::fromParts({}, {}, pathOnDevice); } Environment DesktopDevice::systemEnvironment() const diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index 32b456b6784..9136d24e492 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -34,9 +34,9 @@ public: bool handlesFile(const Utils::FilePath &filePath) const override; Utils::Environment systemEnvironment() const override; - Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; Utils::FilePath rootPath() const override; + Utils::FilePath filePath(const QString &pathOnDevice) const override; protected: DesktopDevice(); diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 570bf994940..2f3d0ca94a3 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -200,20 +200,10 @@ DeviceFileAccess *IDevice::fileAccess() const return d->fileAccess; } -FilePath IDevice::mapToGlobalPath(const FilePath &pathOnDevice) const -{ - if (pathOnDevice.needsDevice()) { - // Already correct form, only sanity check it's ours... - QTC_CHECK(handlesFile(pathOnDevice)); - return pathOnDevice; - } - // match DeviceManager::deviceForPath - return FilePath::fromParts(u"device", id().toString(), pathOnDevice.path()); -} - FilePath IDevice::filePath(const QString &pathOnDevice) const { - return mapToGlobalPath(FilePath::fromString(pathOnDevice)); + // match DeviceManager::deviceForPath + return FilePath::fromParts(u"device", id().toString(), pathOnDevice); } bool IDevice::handlesFile(const FilePath &filePath) const @@ -226,8 +216,8 @@ bool IDevice::handlesFile(const FilePath &filePath) const FilePath IDevice::searchExecutableInPath(const QString &fileName) const { FilePaths paths; - for (const FilePath &path : systemEnvironment().path()) - paths.append(mapToGlobalPath(path)); + for (const FilePath &pathEntry : systemEnvironment().path()) + paths.append(filePath(pathEntry.path())); return searchExecutable(fileName, paths); } @@ -235,7 +225,7 @@ FilePath IDevice::searchExecutable(const QString &fileName, const FilePaths &dir { for (FilePath dir : dirs) { if (!handlesFile(dir)) // Allow device-local dirs to be used. - dir = mapToGlobalPath(dir); + dir = filePath(dir.path()); QTC_CHECK(handlesFile(dir)); const FilePath candidate = dir / fileName; if (candidate.isExecutableFile()) diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index f26cb2885f4..708fa1e8b74 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -189,7 +189,7 @@ public: void setMachineType(MachineType machineType); virtual Utils::FilePath rootPath() const; - Utils::FilePath filePath(const QString &pathOnDevice) const; + virtual Utils::FilePath filePath(const QString &pathOnDevice) const; Utils::FilePath debugServerPath() const; void setDebugServerPath(const Utils::FilePath &path); @@ -219,8 +219,6 @@ public: Utils::DeviceFileAccess *fileAccess() const; virtual bool handlesFile(const Utils::FilePath &filePath) const; - virtual Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const; - virtual Utils::FilePath searchExecutableInPath(const QString &fileName) const; virtual Utils::FilePath searchExecutable(const QString &fileName, const Utils::FilePaths &dirs) const; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 2914c75d7c9..59821a03ae1 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1120,7 +1120,7 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector, compilerPaths << candidate; return true; }; - const FilePath globalDir = device->mapToGlobalPath(deviceDir); + const FilePath globalDir = device->filePath(deviceDir.path()); globalDir.iterateDirectory(callBack, {nameFilters, QDir::Files | QDir::Executable}); } } else { diff --git a/src/plugins/projectexplorer/projectconfiguration.cpp b/src/plugins/projectexplorer/projectconfiguration.cpp index 9f14cfb923b..f85f412632e 100644 --- a/src/plugins/projectexplorer/projectconfiguration.cpp +++ b/src/plugins/projectexplorer/projectconfiguration.cpp @@ -119,7 +119,7 @@ FilePath ProjectConfiguration::mapFromBuildDeviceToGlobalPath(const FilePath &pa { IDevice::ConstPtr dev = BuildDeviceKitAspect::device(kit()); QTC_ASSERT(dev, return path); - return dev->mapToGlobalPath(path); + return dev->filePath(path.path()); } Id ProjectExplorer::idFromMap(const QVariantMap &map)