summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdir.cpp
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2015-12-11 13:42:28 +0100
committerMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2016-01-21 05:53:17 +0000
commitf05c597ae506ea6163394dbb6b70ecc77fae3b3c (patch)
tree02a3b3644bd9c0657aed855d7d348d527cdbefce /src/corelib/io/qdir.cpp
parentf4502fbaf0d31d08bf08f1685f1d7b30735b72b4 (diff)
winrt: msvc2015: refactor file handling
msvc2015 reintroduced a couple of functions from the win32 API towards WinRT. Enable usage of those and simplify the file system engine. Furthermore update the autotests. Change-Id: I9eafffba0ddfd05917c184c4a6b9e166f86d71d9 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qdir.cpp')
-rw-r--r--src/corelib/io/qdir.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 4d2b36632f..2c2bdd579e 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -152,7 +152,11 @@ inline void QDirPrivate::setPath(const QString &path)
if (p.endsWith(QLatin1Char('/'))
&& p.length() > 1
#if defined(Q_OS_WIN)
+# if defined (Q_OS_WINRT)
+ && (!(p.toLower() == QDir::rootPath().toLower()))
+# else
&& (!(p.length() == 3 && p.at(1).unicode() == ':' && p.at(0).isLetter()))
+# endif
#endif
) {
p.truncate(p.length() - 1);
@@ -885,6 +889,9 @@ bool QDir::cd(const QString &dirName)
#if defined (Q_OS_UNIX)
//After cleanPath() if path is "/.." or starts with "/../" it means trying to cd above root.
if (newPath.startsWith(QLatin1String("/../")) || newPath == QLatin1String("/.."))
+#elif defined (Q_OS_WINRT)
+ const QString rootPath = QDir::rootPath();
+ if (newPath.size() < rootPath.size() && rootPath.startsWith(newPath))
#else
/*
cleanPath() already took care of replacing '\' with '/'.
@@ -2187,7 +2194,11 @@ QString QDir::cleanPath(const QString &path)
// Strip away last slash except for root directories
if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) {
#if defined (Q_OS_WIN)
+# if defined(Q_OS_WINRT)
+ if (!((ret.length() == 3 || ret.length() == QDir::rootPath().length()) && ret.at(1) == QLatin1Char(':')))
+# else
if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':')))
+# endif
#endif
ret.chop(1);
}