WebFreak001 / FSWatch

A cross-platform folder & file watching library using win32, inotify or std.file
33 stars 8 forks source link

FileChangeEventType.modify has different meaning across platforms #8

Closed FreeSlave closed 8 years ago

FreeSlave commented 8 years ago

On inotify it does not report metadata changes, e.g. permissions. Probably should check for IN_ATTRIB too.

WebFreak001 commented 8 years ago

modify only reports changes to the file, no attribute or other changes

WebFreak001 commented 8 years ago

This is the same on windows, linux and the std.file fallback

FreeSlave commented 8 years ago

Run touch (from msys or some other unix tools bundle on Windows) on file, it will change timestamps that will emit 'modify' on Windows. You also can try some other tool or change timestamp programmatically.

See documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364391(v=vs.85).aspx

The file was modified. This can be a change in the time stamp or attributes.

I'm not sure though what are 'attributes' in this case. It seems it does not report permission changes.

WebFreak001 commented 8 years ago

Im only checking for FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE

So it will update when the last write time changed. Because it can't possibly always look at the file contents and memorize them, It checks for changes via the write time.

I think it's more a bug that it doesn't check for that on linux

FreeSlave commented 8 years ago

Yes, that's what I'm talking about. Adding IN_ATTRIB should fix it.