Adjust the comment about QFileInfo::operator==().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28859 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-03-18 22:49:11 +00:00
parent 22e1e85c8e
commit 1a94a63db8

View File

@ -921,6 +921,12 @@ docstring const FileName::relPath(string const & path) const
} }
// Note: According to Qt, QFileInfo::operator== is undefined when
// both files do not exist (Qt4.5 gives true for all non-existent
// files, while Qt4.4 compares the filenames).
// see:
// http://www.qtsoftware.com/developer/task-tracker/
// index_html?id=248471&method=entry.
bool operator==(FileName const & l, FileName const & r) bool operator==(FileName const & l, FileName const & r)
{ {
// FIXME: In future use Qt. // FIXME: In future use Qt.
@ -944,9 +950,8 @@ bool operator==(FileName const & l, FileName const & r)
if (!lhs.d->fi.isSymLink() && !rhs.d->fi.isSymLink()) { if (!lhs.d->fi.isSymLink() && !rhs.d->fi.isSymLink()) {
// Qt already checks if the filesystem is case sensitive or not. // Qt already checks if the filesystem is case sensitive or not.
// see note above why the extra check with fileName is needed.
return lhs.d->fi == rhs.d->fi return lhs.d->fi == rhs.d->fi
// This is needed as in Qt4.5, QFileInfo::operator== compares
// the location of the two files and not the files themselves.
&& lhs.d->fi.fileName() == rhs.d->fi.fileName(); && lhs.d->fi.fileName() == rhs.d->fi.fileName();
} }
@ -957,8 +962,7 @@ bool operator==(FileName const & l, FileName const & r)
QFileInfo fi2(rhs.d->fi); QFileInfo fi2(rhs.d->fi);
if (fi2.isSymLink()) if (fi2.isSymLink())
fi2 = QFileInfo(fi2.symLinkTarget()); fi2 = QFileInfo(fi2.symLinkTarget());
// This is needed as in Qt4.5, QFileInfo::operator== compares // see note above why the extra check with fileName is needed.
// the location of the two files and not the files themselves.
return fi1 == fi2 && fi1.fileName() == fi2.fileName(); return fi1 == fi2 && fi1.fileName() == fi2.fileName();
} }