Andre Poenitz wrote:
On Sun, Oct 05, 2008 at 02:09:03PM +0200, Peter Kümmel wrote:
Abdelrazak Younes wrote:
Yes, but please use (or extend) already existing FileName::operator==()
FileName::operator==() expands now short names on Windows.
http://www.lyx.org/trac/changeset/26745
In this case I'd prefer a more verbose name. Having non-trivial
operations hidden in customarily "cheap" operators tend to create
unexpected behaviour...
Or we always use long path names internaly, see patch.
--
Peter Kümmel
Index: src/support/FileName.cpp
===================================================================
--- src/support/FileName.cpp (revision 26748)
+++ src/support/FileName.cpp (working copy)
@@ -146,7 +146,8 @@
FileName::FileName(string const & abs_filename)
- : d(abs_filename.empty() ? new Private : new Private(abs_filename))
+ : d(abs_filename.empty() ? new Private
+ : new Private(os::internal_path(abs_filename)))
{
}
@@ -196,7 +197,7 @@
void FileName::set(string const & name)
{
- d->fi.setFile(toqstr(name));
+ d->fi.setFile(toqstr(os::internal_path(name)));
}
@@ -916,15 +917,13 @@
}
-bool operator==(FileName const & l, FileName const & r)
+bool operator==(FileName const & lhs, FileName const & rhs)
{
// FIXME: In future use Qt.
// Qt 4.4: We need to solve this warning from Qt documentation:
// * Long and short file names that refer to the same file on Windows
are
// treated as if they referred to different files.
// This is supposed to be fixed for Qt5.
- FileName const lhs(os::internal_path(l.absFilename()));
- FileName const rhs(os::internal_path(r.absFilename()));
if (lhs.empty())
// QFileInfo::operator==() returns false if the two QFileInfo
are empty.