Fix debugging on iOS

The RunControl nowadays asks
DeviceManager::deviceForPath(runnable.command.executable) to get the
device, instead of passing that through the runnable.

Since the runnable's command executable is set via
IDevice::filePath(pathOnDevice), where "pathOnDevice" by default is from
the executableAspect, IDevice::filePath should actually return a
"global" path in the form of "device://<device-id>/<path-on-device>".

Since we do not want "device:...." paths for the desktop, return the
simple path in that case only instead.

Fixes: QTCREATORBUG-27709
Change-Id: I75f9406cf3254980e1fee203275b0e72202b7b6d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2022-06-13 17:10:03 +02:00
parent 4e69aece65
commit fd90cf0a82
5 changed files with 20 additions and 17 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;
}

View File

@@ -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())

View File

@@ -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;