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,8 +834,17 @@ void DockerDevicePrivate::startContainer()
|
||||
dockerRun.addArgs({"-u", QString("%1:%2").arg(getuid()).arg(getgid())});
|
||||
#endif
|
||||
|
||||
for (const QString &mount : qAsConst(m_data.mounts)) {
|
||||
if (!mount.isEmpty())
|
||||
for (QString mount : qAsConst(m_data.mounts)) {
|
||||
if (mount.isEmpty())
|
||||
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});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user