diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-09-06 16:43:29 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-06 17:32:57 +0200 |
commit | 0b67ad9db2647a69a56bd4ebb4609bb259932cb0 (patch) | |
tree | 6e22b595ae1fe26a1d12cc277a2bf4c53310872f /src/corelib/io/qfileinfo.cpp | |
parent | 1189ebff320b8dd03637947c92df6e3ef84a3c06 (diff) |
Merge fixes for QDir::operator==
There were two fixes in 4.8 which each fixed a part of the problem.
Comparing canonical paths is more correct, but is only possible where
both directories exist. If neither directory exists, then compare
absolute paths instead.
Changed a regression test, because /tmp is a symbolic link on MacOS.
I.E. "/tmp/.." is canonically "/private" and not "/" as expected.
Task-Number: QTBUG-20495
Reviewed-By: joao
(cherry-picked from ad35d25e78c8252a72108a4ba931934047c4707e)
Change-Id: Ia4986e8337f0e512e1a3398a5a4dd36e62680b9c
Reviewed-on: http://codereview.qt-project.org/5813
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/corelib/io/qfileinfo.cpp')
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index b560a81ac5..0ee851fd14 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -403,6 +403,11 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const return true; if (d->isDefaultConstructed || fileinfo.d_ptr->isDefaultConstructed) return false; + + // Assume files are the same if path is the same + if (d->fileEntry.filePath() == fileinfo.d_ptr->fileEntry.filePath()) + return true; + Qt::CaseSensitivity sensitive; if (d->fileEngine == 0 || fileinfo.d_ptr->fileEngine == 0) { if (d->fileEngine != fileinfo.d_ptr->fileEngine) // one is native, the other is a custom file-engine |