forked from qt-creator/qt-creator
Docker: Use new FilePath API directly
No need to take the QUrl detour. Change-Id: Ia8245f671411f58729834777413b4749f14b128e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -588,22 +588,21 @@ DeviceEnvironmentFetcher::Ptr DockerDevice::environmentFetcher() const
|
|||||||
|
|
||||||
FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
|
FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
|
||||||
{
|
{
|
||||||
QUrl url = pathOnDevice.toUrl();
|
if (pathOnDevice.needsDevice()) {
|
||||||
if (url.isValid()) {
|
// Already correct form, only sanity check it's ours...
|
||||||
QTC_CHECK(url.host() == d->m_data.imageId);
|
QTC_CHECK(handlesFile(pathOnDevice));
|
||||||
QTC_CHECK(url.scheme() == "docker");
|
|
||||||
return pathOnDevice;
|
return pathOnDevice;
|
||||||
}
|
}
|
||||||
url.setScheme("docker");
|
FilePath result;
|
||||||
url.setHost(d->m_data.imageId);
|
result.setScheme("docker");
|
||||||
url.setPath(pathOnDevice.toString());
|
result.setHost(d->m_data.imageId);
|
||||||
return FilePath::fromUrl(url);
|
result.setPath(pathOnDevice.path());
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockerDevice::handlesFile(const FilePath &filePath) const
|
bool DockerDevice::handlesFile(const FilePath &filePath) const
|
||||||
{
|
{
|
||||||
const QUrl &url = filePath.toUrl();
|
return filePath.scheme() == "docker" && filePath.host() == d->m_data.imageId;
|
||||||
return url.scheme() == "docker" && url.host() == d->m_data.imageId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DockerDevice::isExecutableFile(const FilePath &filePath) const
|
bool DockerDevice::isExecutableFile(const FilePath &filePath) const
|
||||||
|
Reference in New Issue
Block a user