From ec8c1dcf147ac71ea3c0105d67c2575ab733d348 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 4 Jun 2015 16:02:06 +0200 Subject: Make QDir::relativeFilePath() return "." for a path to itself. The rationale being that the empty string is not a valid path component. [ChangeLog][QtCore][QDir] QDir::relativeFilePath() now returns "." instead of an empty string if the given path is the same as the directory. Change-Id: Ibcf31904b2ae5edf5639d4c2e5ba234365d347fd Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qdir.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/io/qdir.cpp') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9b1ec3917a..6687ff846c 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -777,6 +777,8 @@ QString QDir::relativeFilePath(const QString &fileName) const result += QLatin1Char('/'); } + if (result.isEmpty()) + return QLatin1String("."); return result; } -- cgit v1.2.3