diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 8948004d6f4..21be6ec9020 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -1001,9 +1001,7 @@ bool FilePath::endsWith(const QString &s) const */ bool FilePath::startsWithDriveLetter() const { - if (needsDevice() || !HostOsInfo::isWindowsHost()) - return false; - return m_path.size() >= 2 && isWindowsDriveLetter(m_path[0]) && m_path.at(1) == ':'; + return !needsDevice() && m_path.size() >= 2 && isWindowsDriveLetter(m_path[0]) && m_path.at(1) == ':'; } /*! diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 68d0ee8866d..c442a6593e3 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -636,7 +636,7 @@ QString DockerDevice::mapToDevicePath(const Utils::FilePath &globalPath) const // C:/dev/src -> /c/dev/src const FilePath normalized = FilePath::fromString(globalPath.path()).normalizedPathName(); QString path = normalized.path(); - if (normalized.startsWithDriveLetter()) { + if (HostOsInfo::isWindowsHost() && normalized.startsWithDriveLetter()) { const QChar lowerDriveLetter = path.at(0).toLower(); path = '/' + lowerDriveLetter + path.mid(2); // strip C: } diff --git a/src/plugins/projectexplorer/buildaspects.cpp b/src/plugins/projectexplorer/buildaspects.cpp index bf6564614fb..5f80e50eabb 100644 --- a/src/plugins/projectexplorer/buildaspects.cpp +++ b/src/plugins/projectexplorer/buildaspects.cpp @@ -113,7 +113,7 @@ void BuildDirectoryAspect::addToLayout(LayoutBuilder &builder) FilePath BuildDirectoryAspect::fixupDir(const FilePath &dir) { - if (!dir.startsWithDriveLetter()) + if (HostOsInfo::isWindowsHost() && !dir.startsWithDriveLetter()) return {}; const QString dirString = dir.toString().toLower(); const QStringList drives = Utils::transform(QDir::drives(), [](const QFileInfo &fi) { diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp index 1fa834a7017..ef375913fcd 100644 --- a/tests/auto/utils/fileutils/tst_fileutils.cpp +++ b/tests/auto/utils/fileutils/tst_fileutils.cpp @@ -789,9 +789,6 @@ void tst_fileutils::asyncLocalCopy() void tst_fileutils::startsWithDriveLetter_data() { - if (!HostOsInfo::isWindowsHost()) - QSKIP("This test is only relevant on Windows"); - QTest::addColumn("path"); QTest::addColumn("expected");