From d7d1a90de612f55e9a519024296a9b5a8371bd7d Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 13 Aug 2022 12:32:07 +0800 Subject: [PATCH] Fix wrong parent path --- src/base/path.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/path.cpp b/src/base/path.cpp index 867548beb..51bea7694 100644 --- a/src/base/path.cpp +++ b/src/base/path.cpp @@ -162,8 +162,8 @@ Path Path::parentPath() const #ifdef Q_OS_WIN // should be `c:/` instead of `c:` // Windows "drive letter" is limited to one alphabet - if ((slashIndex == 2) && (m_pathStr.at(1) == u':')) - return createUnchecked(m_pathStr.left(slashIndex + 1)); + if ((slashIndex == 2) && hasDriveLetter(m_pathStr)) + return (m_pathStr.size() == 3) ? Path() : createUnchecked(m_pathStr.left(slashIndex + 1)); #endif return createUnchecked(m_pathStr.left(slashIndex)); }