From 09ead204ea9c11442e5cf73f23b1d1d0bfc34036 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 9 Jun 2021 17:35:40 +0200 Subject: [PATCH] Utils: Improve FilePath::parentDir() for the remote case QDir::cleanPath() should not be used on FilePath::toString'ed object, it removed the second slash in the :// separator. Change-Id: I0168d52f6d7caa99f5ccc5d1d93ae2bd783332c5 Reviewed-by: David Schulz --- src/libs/utils/fileutils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index a08f7ba98d6..e1dfaea69db 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -954,7 +954,7 @@ bool FilePath::needsDevice() const /// \returns \a FilePath with the last segment removed. FilePath FilePath::parentDir() const { - const QString basePath = toString(); + const QString basePath = path(); if (basePath.isEmpty()) return FilePath(); @@ -966,7 +966,9 @@ FilePath FilePath::parentDir() const const QString parent = QDir::cleanPath(path); QTC_ASSERT(parent != path, return FilePath()); - return FilePath::fromString(parent); + FilePath result = *this; + result.setPath(parent); + return result; } FilePath FilePath::absolutePath() const