Opened 6 years ago

Closed 6 years ago

#14833 closed enhancement (fixed)

wxFileSystemWatcher: Add wxFSW_EVENT_ATTRIB flag for inotify's IN_ATTRIB

Reported by: dghart Owned by:
Priority: normal Milestone: 2.9.5
Component: base Version: stable-latest
Keywords: wxFileSystemWatcher wxFSW_EVENT_ATTRIB Cc:
Blocked By: Blocking:
Patch: yes


wxFileSystemWatcher currently ignores a couple of useful inotify events (and several less-useful ones). In particular, without IN_ATTRIB there's no way of detecting a file being touched.

The attached patch implements this. There's a new wxFSW_EVENT_ATTRIB in the wxFSWFlags enum. I've not #if def.ed this as it looks as if it could be extended to the other platforms in the future. The MSW equivalent would be FILE_NOTIFY_CHANGE_ATTRIBUTES, which is currently unmapped in wxIOCPThread::Native2WatcherFlags. NOTE_ATTRIB, the nearest kqueue equivalent, is already mapped to wxFSW_EVENT_ACCESS (though from reading the man-page, wxFSW_EVENT_MODIFY might have been more appropriate). BTW, the wxFSWFlags doc states that wxFSW_EVENT_ACCESS is 'currently only detected under Linux' which is presumably wrong, but I'm unable to test that here.

I've added a test for the new flag, and it can also be seen to work in the fswatcher sample.

Attachments (1)

attribute.diff download (5.8 KB) - added by dghart 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by dghart

comment:1 Changed 6 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [72977]) Add wxFSW_EVENT_ATTRIB wxFileSystemWatcher flag.

This flag allows to monitor changes to the file attributes, such as file
modification time.

This patch adds the flag, support for it under Linux and the corresponding
modifications to the sample and the test suite.

Closes #14833.

Note: See TracTickets for help on using tickets.