summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdir.cpp
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2010-01-29 12:12:39 (GMT)
committerJoão Abecasis <joao@trolltech.com>2010-01-29 12:12:39 (GMT)
commitc43400792b637c744ca840a4ecb339ffdb27c604 (patch)
tree8d03a7568d0b36f1bc6fddccfee5ed5a6292e0f3 /src/corelib/io/qdir.cpp
parent2964718224c0ed356511335742368d4fc421c6bd (diff)
downloadQt-c43400792b637c744ca840a4ecb339ffdb27c604.zip
Qt-c43400792b637c744ca840a4ecb339ffdb27c604.tar.gz
Qt-c43400792b637c744ca840a4ecb339ffdb27c604.tar.bz2
QDir::cleanPath: strip trailing slash for "/:/" on non-win platforms
Merge-request: 445 Reviewed-by: João Abecasis <joao@trolltech.com>
Diffstat (limited to 'src/corelib/io/qdir.cpp')
-rw-r--r--src/corelib/io/qdir.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 6b79cae..f465e73 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -2193,9 +2193,12 @@ QString QDir::cleanPath(const QString &path)
ret = QString(out, used);
// Strip away last slash except for root directories
- if (ret.endsWith(QLatin1Char('/'))
- && !(ret.size() == 1 || (ret.size() == 3 && ret.at(1) == QLatin1Char(':'))))
- ret = ret.left(ret.length() - 1);
+ if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) {
+#ifdef Q_OS_WIN
+ if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':')))
+#endif
+ ret.chop(1);
+ }
return ret;
}