Utils: Introduce FilePath::mapTo{Device,Global}Path

Re-directing via IDevice::mapTo{Device,Global}Path

Change-Id: Ica957839479967790bbd93e90eced66aa0b122a8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-10-08 10:31:30 +02:00
parent f49fbe7f58
commit 34b42a4772
8 changed files with 53 additions and 0 deletions

View File

@@ -1069,6 +1069,17 @@ FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
return result;
}
QString DockerDevice::mapToDevicePath(const Utils::FilePath &globalPath) const
{
const FilePath normalized = globalPath.normalizedPathName();
QString path = normalized.path();
if (normalized.startsWithDriveLetter()) {
const QChar lowerDriveLetter = path.at(0).toLower();
path = '/' + lowerDriveLetter + path.mid(2); // strip C:
}
return path;
}
bool DockerDevice::handlesFile(const FilePath &filePath) const
{
return filePath.scheme() == "docker" && filePath.host() == d->m_data.imageId;