On Sat, Mar 11, 2017 at 08:36:08PM +0100, Jean-Marc Lasgouttes wrote: > Le 11/03/2017 à 19:21, Enrico Forestieri a écrit : > > I think that a problem could arise only if the file is a symlink. > > In this case, stat() resolves it and returns information about the > > pointed-to file. It is not very clear what QFileInfo::lastModified() > > does. Skimming the docs, it maybe does the same, possibly except on > > native Windows. > > Does native windows support symlinks?
Yes, since Vista. But not Qt, seemingly. https://msdn.microsoft.com/it-it/library/windows/desktop/aa365680(v=vs.85).aspx > > BTW, what's the problem in considering the file as non > > existing if stat() does not return 0? > > That's what I began to do, and then it occurred to me that we were mixing > FileName stuff with raw unix calls. Uh? stat() is posix and has always worked also on windows. > If FileName::lastModified does not work > correctly, I'd say that we should fix it rather than avoid using it. Then, go for it. Personally, I am inclined to follow the principle of not fixing it if it is not broken, but I don't want stop you. BTW, I just verified that both stat() and QFileInfo::lastModified() don't follow symlinks on native windows, while both do on *nix. So, there will not be changed behavior, AFAICS. -- Enrico