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; return result;
} }
QString escapeMountPath(const FilePath &fp)
{
if (HostOsInfo::isWindowsHost())
return escapeMountPathWin(fp);
return escapeMountPathUnix(fp);
}
QStringList toMountArg(const DockerDevicePrivate::TemporaryMountInfo &mi) QStringList toMountArg(const DockerDevicePrivate::TemporaryMountInfo &mi)
{ {
QString escapedPath; QString escapedPath;
QString escapedContainerPath; QString escapedContainerPath;
if (HostOsInfo::isWindowsHost()) { escapedPath = escapeMountPath(mi.path);
escapedPath = escapeMountPathWin(mi.path); escapedContainerPath = escapeMountPath(mi.containerPath);
escapedContainerPath = escapeMountPathWin(mi.containerPath);
} else {
escapedPath = escapeMountPathUnix(mi.path);
escapedContainerPath = escapeMountPathUnix(mi.containerPath);
}
const QString mountArg = QString(R"(type=bind,"source=%1","destination=%2")") const QString mountArg = QString(R"(type=bind,"source=%1","destination=%2")")
.arg(escapedPath) .arg(escapedPath)