diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2011-08-11 14:17:40 (GMT) |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2011-08-26 12:07:36 (GMT) |
commit | 664abe11efdbf582a5433abccf0d8c6fdbe2b040 (patch) | |
tree | ede8c86e75272b1b9197a91b13a26cccf654e8e6 | |
parent | dcee6e1371d899eb79717b8e3f3eec08b765db82 (diff) | |
download | Qt-664abe11efdbf582a5433abccf0d8c6fdbe2b040.zip Qt-664abe11efdbf582a5433abccf0d8c6fdbe2b040.tar.gz Qt-664abe11efdbf582a5433abccf0d8c6fdbe2b040.tar.bz2 |
Compare non-canonical paths before falling back on expensive computation
Reviewed-by: Prasanth Ullattil
-rw-r--r-- | src/corelib/io/qdir.cpp | 4 | ||||
-rw-r--r-- | src/corelib/io/qfileinfo.cpp | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 6e25d91..c0c62e1 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1634,6 +1634,10 @@ bool QDir::operator==(const QDir &dir) const && d->sort == other->sort && d->nameFilters == other->nameFilters) { + // Assume directories are the same if path is the same + if (d->dirEntry.filePath() == other->dirEntry.filePath()) + return true; + // Fallback to expensive canonical path computation return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; } diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index 6e25206..ff328da 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -391,6 +391,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 |