Docker: combine escapeMountPath function

Change-Id: Ib04f8245d2da096a9d9fdbdf9b5243ca80d52bfa
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-10-14 10:21:49 +02:00
parent 9aa1d56f56
commit 359ad56e17

View File

@@ -520,18 +520,21 @@ QString escapeMountPathWin(const FilePath &fp)
return result;
}
QString escapeMountPath(const FilePath &fp)
{
if (HostOsInfo::isWindowsHost())
return escapeMountPathWin(fp);
return escapeMountPathUnix(fp);
}
QStringList toMountArg(const DockerDevicePrivate::TemporaryMountInfo &mi)
{
QString escapedPath;
QString escapedContainerPath;
if (HostOsInfo::isWindowsHost()) {
escapedPath = escapeMountPathWin(mi.path);
escapedContainerPath = escapeMountPathWin(mi.containerPath);
} else {
escapedPath = escapeMountPathUnix(mi.path);
escapedContainerPath = escapeMountPathUnix(mi.containerPath);
}
escapedPath = escapeMountPath(mi.path);
escapedContainerPath = escapeMountPath(mi.containerPath);
const QString mountArg = QString(R"(type=bind,"source=%1","destination=%2")")
.arg(escapedPath)