rgheck schreef:
Vincent van Ravesteijn wrote:
rgheck schreef:
Vincent van Ravesteijn wrote:
rgheck schreef:
So removing the refresh calls shouldn't hurt? And didn't that
solve the problem for you? Or did you have to do something else, too?
No, Yes I had to remove the "FileName const
lhs(os::internal_path(l.absFilename()));" calls too.. but these
shouldn't be necessary for a filenames made with
filetools::makeAbsPath(), so when are these necessary?
I think they were added to deal with the long-short filename
problem, but I can't access "svn blame" now (my password won't
work), so I'm not sure. If so, however, this is of course a Windows
issue....
rh
Yes, that's the reason, but all FileNames that are created with
makeAbsPath already have the long format. I expect that the majority
of filenames are created by makeAbsPath. So if we can identify the
places where short names might occur, we can move these calls from
the FileName class (or at least from ==()).
Could do that. But I'm guessing the constructor calls themselves are
actually quite cheap, EXCEPT for the file system access in the
fi.exists() check. That's the culprit, isn't it? And I worry that
it'll still be the culprit in other cases, so we need to deal with it
anyway.
rh
I'd do rather something like this. The only time we care about caching
is when we are really interested in a file's existence.
Vincent
diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp
index 65c682c..9187814 100644
--- a/src/support/FileName.cpp
+++ b/src/support/FileName.cpp
@@ -105,7 +105,6 @@ struct FileName::Private
Private(string const & abs_filename) : fi(toqstr(abs_filename))
{
- fi.setCaching(fi.exists() ? true : false);
}
///
inline void refresh()
@@ -279,7 +278,9 @@ FileName FileName::fromFilesystemEncoding(string const &
name)
bool FileName::exists() const
{
- return d->fi.exists();
+ bool const exists = d->fi.exists();
+ fi.setCaching(exists);
+ return exists;
}