diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 1ffbdba5f71..64e9556995d 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -179,6 +179,12 @@ bool DesktopDevice::setPermissions(const FilePath &filePath, QFile::Permissions return filePath.setPermissions(permissions); } +FilePath DesktopDevice::mapToGlobalPath(const Utils::FilePath &pathOnDevice) const +{ + QTC_CHECK(!pathOnDevice.needsDevice()); + return pathOnDevice; +} + Environment DesktopDevice::systemEnvironment() const { return Environment::systemEnvironment(); diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index 391bf53997f..37dc326a989 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -79,6 +79,7 @@ public: qint64 fileSize(const Utils::FilePath &filePath) const override; QFile::Permissions permissions(const Utils::FilePath &filePath) const override; bool setPermissions(const Utils::FilePath &filePath, QFile::Permissions) const override; + Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; protected: DesktopDevice(); diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 69344b44a2c..f7ca5633bb7 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -212,7 +212,17 @@ bool IDevice::isAnyUnixDevice() const FilePath IDevice::mapToGlobalPath(const FilePath &pathOnDevice) const { - return pathOnDevice; + if (pathOnDevice.needsDevice()) { + // Already correct form, only sanity check it's ours... + QTC_CHECK(handlesFile(pathOnDevice)); + return pathOnDevice; + } + // match DeviceManager::deviceForPath + FilePath result; + result.setPath(pathOnDevice.path()); + result.setScheme("device"); + result.setHost(id().toString()); + return result; } QString IDevice::mapToDevicePath(const FilePath &globalPath) const @@ -227,7 +237,8 @@ FilePath IDevice::filePath(const QString &pathOnDevice) const bool IDevice::handlesFile(const FilePath &filePath) const { - Q_UNUSED(filePath); + if (filePath.scheme() == "device" && filePath.host() == id().toString()) + return true; return false; } diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 9f68025c688..edc6a624562 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1104,20 +1104,6 @@ QString LinuxDevice::userAtHost() const return sshParameters().userAtHost(); } -FilePath LinuxDevice::mapToGlobalPath(const FilePath &pathOnDevice) const -{ - if (pathOnDevice.needsDevice()) { - // Already correct form, only sanity check it's ours... - QTC_CHECK(handlesFile(pathOnDevice)); - return pathOnDevice; - } - FilePath result; - result.setScheme("device"); - result.setHost(id().toString()); - result.setPath(pathOnDevice.path()); - return result; -} - bool LinuxDevice::handlesFile(const FilePath &filePath) const { if (filePath.scheme() == "device" && filePath.host() == id().toString()) diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 1b286ac1080..2e7000a09dd 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -56,7 +56,6 @@ public: ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; QString userAtHost() const; - Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; bool handlesFile(const Utils::FilePath &filePath) const override; bool isExecutableFile(const Utils::FilePath &filePath) const override;