Correctly detect drive letter in path

PR #18258.
Closes #18224.
This commit is contained in:
Vladimir Golovnev 2022-12-22 08:22:06 +03:00 committed by GitHub
parent 691cb4fe2b
commit 0da132b69e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));