aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/fileutils.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2021-06-09 17:35:40 +0200
committerhjk <[email protected]>2021-06-10 05:59:31 +0000
commit09ead204ea9c11442e5cf73f23b1d1d0bfc34036 (patch)
tree554a1ff96e2ef0a8cedbca03e3085ab7ef8089e8 /src/libs/utils/fileutils.cpp
parent18245dcf1083a19e592254fd5e1337fcde1abf4a (diff)
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 <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r--src/libs/utils/fileutils.cpp6
1 files 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