[Qt-interest] QFileSystemWatcher missing file changes?
Bob Hood
bhood2 at comcast.net
Wed Mar 17 15:43:08 CET 2010
Oliver.Knoll at comit.ch wrote:
> Bob Hood wrote on Tuesday, March 16, 2010 11:15 PM:
>> ..
>> Unfortunately, QFileSystemWatcher doesn't behave the way I expect it
>> to. When watching a folder, it generates events for file additions
>> and removals, but does not report that the folder had a change when a
>> file is modified -- i.e., it's time stamp changes.
> But I agree that the use-case you have does really scream for such an extended functionallity ("add a directory path and get notified when files therein change - maybe just direct children, not files in subdirectories, as to simplify the task"). Maybe you could add it as a feature request? If you say that at least on Windows there exists an API for that chances are that other platforms offer something similar and it could be added to a later Qt :)
I tested both FindFirstChangeNotification() and ReadDirectoryChangesW(),
which are, of course, Windows-only, and they both notify when, for
example, the time stamp of a file buried many levels deep in the watched
folder is modified. They also notify on creation, name change, removal,
size change, etc. Exactly the kind of efficiency I would need I guess
for the overhead I am envisioning. I haven't looked at the code for
QFileSystemWatcher, so I don't know if it is based on either of these
functions under the Windows build, or if it's doing something else.
Thanks for the reply, Oliver. Just wanted to make sure I wasn't
misunderstanding its functionality.
More information about the Qt-interest-old
mailing list