From 2fa5ad982d9f50debcad0a5a0eb1fd7b38fe7ebf Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 27 Jul 2022 01:43:23 +0800 Subject: [PATCH] Improve absolute/relative path detection --- src/base/path.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/base/path.cpp b/src/base/path.cpp index bf8b8d481..21437b19d 100644 --- a/src/base/path.cpp +++ b/src/base/path.cpp @@ -95,11 +95,17 @@ bool Path::isEmpty() const bool Path::isAbsolute() const { + // `QDir::isAbsolutePath` treats `:` as a path to QResource, so handle it manually + if (m_pathStr.startsWith(u':')) + return false; return QDir::isAbsolutePath(m_pathStr); } bool Path::isRelative() const { + // `QDir::isRelativePath` treats `:` as a path to QResource, so handle it manually + if (m_pathStr.startsWith(u':')) + return true; return QDir::isRelativePath(m_pathStr); }