summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-09-16 15:02:01 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-09-16 15:02:01 (GMT)
commit3df81c23e6ab7dae949315a4f0ca4e54469ab2bf (patch)
tree2e2e00055722a8130d33320dda243dae12a57986
parentb9b55234a777c3b206332bafbe227e1355ca9186 (diff)
downloadQt-3df81c23e6ab7dae949315a4f0ca4e54469ab2bf.zip
Qt-3df81c23e6ab7dae949315a4f0ca4e54469ab2bf.tar.gz
Qt-3df81c23e6ab7dae949315a4f0ca4e54469ab2bf.tar.bz2
Fix for QDir constructed with a path containing native separators.
QFileSystemEntry's m_filePath should always contain a path with / as separator. Reviewed-By: Thomas Zander
-rw-r--r--src/corelib/io/qdir.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index efc0ba9..a45c104 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -175,13 +175,15 @@ public:
return ret;
}
- inline void setPath(QString p)
+ inline void setPath(const QString &path)
{
- if ((p.endsWith(QLatin1Char('/')) || p.endsWith(QLatin1Char('\\')))
- && p.length() > 1) {
+ QString p = QDir::fromNativeSeparators(path);
+ if (p.endsWith(QLatin1Char('/'))
+ && p.length() > 1
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
- if (!(p.length() == 3 && p.at(1) == QLatin1Char(':')))
+ && (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter()))
#endif
+ ) {
p.truncate(p.length() - 1);
}