From b12fdcf018df75733f594839ac66ca7c4f89018f Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Tue, 20 Dec 2022 07:14:31 +0300 Subject: [PATCH] Correctly detect drive letter in path PR #18258. Closes #18224. --- src/base/path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/path.cpp b/src/base/path.cpp index 51bea7694..0eef0fa20 100644 --- a/src/base/path.cpp +++ b/src/base/path.cpp @@ -142,7 +142,7 @@ Path Path::rootItem() const #ifdef Q_OS_WIN // should be `c:/` instead of `c:` - if (m_pathStr.at(slashIndex - 1) == u':') + if ((slashIndex == 2) && hasDriveLetter(m_pathStr)) return createUnchecked(m_pathStr.left(slashIndex + 1)); #endif return createUnchecked(m_pathStr.left(slashIndex));