summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-03-09 18:46:08 (GMT)
committerJoão Abecasis <joao.abecasis@nokia.com>2011-03-18 11:09:04 (GMT)
commitc7748b7838522ec38ec01423f1267acf1f163606 (patch)
tree5dc7dab7b4743dfea0cec406d20a6d86466038ac /src/corelib
parent5134b700b7311e39b25bd783f213e374de5efaaa (diff)
downloadQt-c7748b7838522ec38ec01423f1267acf1f163606.zip
Qt-c7748b7838522ec38ec01423f1267acf1f163606.tar.gz
Qt-c7748b7838522ec38ec01423f1267acf1f163606.tar.bz2
QDir: Fix absolute paths when using file engines
QFileSystemEntry doesn't know about paths as implemented by custom file engines, such as is the case with resource files. In such cases, we need to allow the engine to make the relative to absolute conversion. Expanded QDir's test case to ensure resource paths are considered in more places. Task-number: QTBUG-17921 Reviewed-by: Prasanth Ullattil
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qdir.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 42f1652..166513a 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -196,12 +196,19 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
if (!absoluteDirEntry.isEmpty() || dirEntry.isEmpty())
return;
- if (dirEntry.isRelative()) {
- QFileSystemEntry answer = QFileSystemEngine::absoluteName(dirEntry);
- absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(answer.filePath()), QFileSystemEntry::FromInternalPath());
+ QString absoluteName;
+ if (fileEngine.isNull()) {
+ if (!dirEntry.isRelative()) {
+ absoluteDirEntry = dirEntry;
+ return;
+ }
+
+ absoluteName = QFileSystemEngine::absoluteName(dirEntry).filePath();
} else {
- absoluteDirEntry = dirEntry;
+ absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName);
}
+
+ absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath());
}
/* For sorting */