forked from qt-creator/qt-creator
Docker: fix device path mapping
Amends 1fa3255242
Change-Id: Idd2e0916769cd822b97e1fc851d8f706316cca83
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -123,6 +123,7 @@ public:
|
||||
|
||||
RunResult runInShell(const CommandLine &cmdLine,
|
||||
const QByteArray &stdInData) const override;
|
||||
QString mapToDevicePath(const FilePath &filePath) const override;
|
||||
|
||||
DockerDevicePrivate *m_dev = nullptr;
|
||||
};
|
||||
@@ -353,6 +354,19 @@ RunResult DockerDeviceFileAccess::runInShell(const CommandLine &cmdLine,
|
||||
return m_dev->runInShell(cmdLine, stdInData);
|
||||
}
|
||||
|
||||
QString DockerDeviceFileAccess::mapToDevicePath(const FilePath &filePath) const
|
||||
{
|
||||
// make sure to convert windows style paths to unix style paths with the file system case:
|
||||
// C:/dev/src -> /c/dev/src
|
||||
const FilePath normalized = FilePath::fromString(filePath.path()).normalizedPathName();
|
||||
QString path = normalized.path();
|
||||
if (HostOsInfo::isWindowsHost() && normalized.startsWithDriveLetter()) {
|
||||
const QChar lowerDriveLetter = path.at(0);
|
||||
path = '/' + lowerDriveLetter + path.mid(2); // strip C:
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
DockerDevice::DockerDevice(DockerSettings *settings, const DockerDeviceData &data)
|
||||
: d(new DockerDevicePrivate(this, settings, data))
|
||||
{
|
||||
@@ -774,19 +788,6 @@ FilePath DockerDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
|
||||
// result.setHost(id().toString());
|
||||
}
|
||||
|
||||
QString DockerDevice::mapToDevicePath(const Utils::FilePath &globalPath) const
|
||||
{
|
||||
// make sure to convert windows style paths to unix style paths with the file system case:
|
||||
// C:/dev/src -> /c/dev/src
|
||||
const FilePath normalized = FilePath::fromString(globalPath.path()).normalizedPathName();
|
||||
QString path = normalized.path();
|
||||
if (HostOsInfo::isWindowsHost() && normalized.startsWithDriveLetter()) {
|
||||
const QChar lowerDriveLetter = path.at(0).toLower();
|
||||
path = '/' + lowerDriveLetter + path.mid(2); // strip C:
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
Utils::FilePath DockerDevice::rootPath() const
|
||||
{
|
||||
return FilePath::fromParts(Constants::DOCKER_DEVICE_SCHEME, d->repoAndTag(), u"/");
|
||||
|
||||
Reference in New Issue
Block a user