forked from qt-creator/qt-creator
Utils: Consolidate the isRelative/isAbsolute implementations
Even if we do it wrong in corner cases, we should do it consistently. Change-Id: I68d5a6e55ede889cb44bedb46d0ea545dae7ba2c Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -625,7 +625,7 @@ FilePath FilePath::withExecutableSuffix() const
|
||||
|
||||
static bool startsWithWindowsDriveLetterAndSlash(QStringView path)
|
||||
{
|
||||
return path.size() > 2 && (path[1] == ':' && path[2] == '/' && isWindowsDriveLetter(path[0]));
|
||||
return path.size() > 2 && path[1] == ':' && path[2] == '/' && isWindowsDriveLetter(path[0]);
|
||||
}
|
||||
|
||||
int FilePath::rootLength(const QStringView path)
|
||||
@@ -1533,7 +1533,7 @@ bool FilePath::isRelativePath() const
|
||||
const QStringView p = pathView();
|
||||
if (p.startsWith('/'))
|
||||
return false;
|
||||
if (p.size() > 1 && isWindowsDriveLetter(p[0]) && p.at(1) == ':')
|
||||
if (startsWithWindowsDriveLetterAndSlash(p))
|
||||
return false;
|
||||
if (p.startsWith(u":/")) // QRC
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user