summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfileinfo.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-08-11 15:49:37 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-06 11:24:20 +0200
commitd3ef64261484ef1e750671263429810918ca6954 (patch)
tree4768ba85fd65984489026329af9f2012e1ba340d /src/corelib/io/qfileinfo.cpp
parentcdef65351917efd6de36a7c85b4bce2aaa249665 (diff)
Fix QDir::operator==(const QDir &) const
We can't rely on absolute paths when comparing directories for equality as these don't take into account symbolic links and may also bypass ../ and ./ simplification. Instead, canonical paths must be computed and can then be compared according to the case sensitivity rules for the platform or file engine, as is done in QFileInfo. Task-number: QTBUG-20495 Reviewed-by: Prasanth Ullattil (cherry-picked from dcee6e1371d899eb79717b8e3f3eec08b765db82) Change-Id: Ib5f2a6ee11311c55782ea5dd0e9c3b45f9231686 Reviewed-on: http://codereview.qt-project.org/5812 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'src/corelib/io/qfileinfo.cpp')
-rw-r--r--src/corelib/io/qfileinfo.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index c83c39195a..b560a81ac5 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -418,6 +418,7 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const
if (fileinfo.size() != size()) //if the size isn't the same...
return false;
+ // Fallback to expensive canonical path computation
return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0;
}