Skip to content

Commit

Permalink
Docker: Use new FilePath API directly
Browse files Browse the repository at this point in the history
No need to take the QUrl detour.

Change-Id: Ia8245f671411f58729834777413b4749f14b128e
Reviewed-by: Christian Stenger <[email protected]>
  • Loading branch information
hjk committed May 20, 2021
1 parent 3b87c1e commit bc58589
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/plugins/docker/dockerdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,21 @@ DeviceEnvironmentFetcher::Ptr DockerDevice::environmentFetcher() const

FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
{
QUrl url = pathOnDevice.toUrl();
if (url.isValid()) {
QTC_CHECK(url.host() == d->m_data.imageId);
QTC_CHECK(url.scheme() == "docker");
if (pathOnDevice.needsDevice()) {
// Already correct form, only sanity check it's ours...
QTC_CHECK(handlesFile(pathOnDevice));
return pathOnDevice;
}
url.setScheme("docker");
url.setHost(d->m_data.imageId);
url.setPath(pathOnDevice.toString());
return FilePath::fromUrl(url);
FilePath result;
result.setScheme("docker");
result.setHost(d->m_data.imageId);
result.setPath(pathOnDevice.path());
return result;
}

bool DockerDevice::handlesFile(const FilePath &filePath) const
{
const QUrl &url = filePath.toUrl();
return url.scheme() == "docker" && url.host() == d->m_data.imageId;
return filePath.scheme() == "docker" && filePath.host() == d->m_data.imageId;
}

bool DockerDevice::isExecutableFile(const FilePath &filePath) const
Expand Down

0 comments on commit bc58589

Please sign in to comment.