forked from qt-creator/qt-creator
Docker: allow windows style paths in settings
Makes sure to convert it to unix style path on the target and use the correct capitalisation on the host Change-Id: I0c6dff47c34c1844a8198c3215ea857fdb6375c7 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -834,9 +834,18 @@ void DockerDevicePrivate::startContainer()
|
|||||||
dockerRun.addArgs({"-u", QString("%1:%2").arg(getuid()).arg(getgid())});
|
dockerRun.addArgs({"-u", QString("%1:%2").arg(getuid()).arg(getgid())});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (const QString &mount : qAsConst(m_data.mounts)) {
|
for (QString mount : qAsConst(m_data.mounts)) {
|
||||||
if (!mount.isEmpty())
|
if (mount.isEmpty())
|
||||||
dockerRun.addArgs({"-v", mount + ':' + mount});
|
continue;
|
||||||
|
// make sure to convert windows style paths to unix style paths with the file system case:
|
||||||
|
// C:/dev/src -> /c/dev/src
|
||||||
|
if (const FilePath mountPath = FilePath::fromUserInput(mount).normalizedPathName();
|
||||||
|
mountPath.startsWithDriveLetter()) {
|
||||||
|
const QChar lowerDriveLetter = mountPath.path().at(0).toLower();
|
||||||
|
const FilePath path = FilePath::fromUserInput(mountPath.path().mid(2)); // strip C:
|
||||||
|
mount = '/' + lowerDriveLetter + path.path();
|
||||||
|
}
|
||||||
|
dockerRun.addArgs({"-v", mount + ':' + mount});
|
||||||
}
|
}
|
||||||
|
|
||||||
dockerRun.addArgs({"--entrypoint", "/bin/sh", m_data.imageId});
|
dockerRun.addArgs({"--entrypoint", "/bin/sh", m_data.imageId});
|
||||||
|
Reference in New Issue
Block a user