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"/");
|
||||
|
@@ -79,7 +79,6 @@ public:
|
||||
bool usableAsBuildDevice() const override;
|
||||
|
||||
Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override;
|
||||
QString mapToDevicePath(const Utils::FilePath &globalPath) const override;
|
||||
|
||||
Utils::FilePath rootPath() const override;
|
||||
|
||||
|
@@ -211,11 +211,6 @@ FilePath IDevice::mapToGlobalPath(const FilePath &pathOnDevice) const
|
||||
return FilePath::fromParts(u"device", id().toString(), pathOnDevice.path());
|
||||
}
|
||||
|
||||
QString IDevice::mapToDevicePath(const FilePath &globalPath) const
|
||||
{
|
||||
return globalPath.path();
|
||||
}
|
||||
|
||||
FilePath IDevice::filePath(const QString &pathOnDevice) const
|
||||
{
|
||||
return mapToGlobalPath(FilePath::fromString(pathOnDevice));
|
||||
|
@@ -219,7 +219,6 @@ public:
|
||||
virtual bool handlesFile(const Utils::FilePath &filePath) const;
|
||||
|
||||
virtual Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const;
|
||||
virtual QString mapToDevicePath(const Utils::FilePath &globalPath) const;
|
||||
|
||||
virtual Utils::FilePath searchExecutableInPath(const QString &fileName) const;
|
||||
virtual Utils::FilePath searchExecutable(const QString &fileName,
|
||||
|
Reference in New Issue
Block a user