- Add wxDIR_NO_FOLLOW flag for wxDir traversal (David Hart).
- Allow testing for symlink/FIFO/socket existence in wxFileName (David Hart).
- Many important bug fixes in wxFileSystemWatcher (David Hart).
+- Add wxFSW_EVENT_ATTRIB flag support to wxFileSystemWatcher (David Hart).
- Add separate read/written bytes counters and per-direction NOWAIT and WAITALL
flags to wxSocket (Rob Bresalier).
- Add wxDir::Close() method (Silverstorm82).
wxFSW_EVENT_RENAME = 0x04,
wxFSW_EVENT_MODIFY = 0x08,
wxFSW_EVENT_ACCESS = 0x10,
+ wxFSW_EVENT_ATTRIB = 0x20, // Currently this is wxGTK-only
// error events
- wxFSW_EVENT_WARNING = 0x20,
- wxFSW_EVENT_ERROR = 0x40,
-
+ wxFSW_EVENT_WARNING = 0x40,
+ wxFSW_EVENT_ERROR = 0x80,
wxFSW_EVENT_ALL = wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE |
wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY |
- wxFSW_EVENT_ACCESS |
+ wxFSW_EVENT_ACCESS | wxFSW_EVENT_ATTRIB |
wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR
};
*/
wxFSW_EVENT_ACCESS = 0x10,
+ /**
+ The item's metadata was changed, e.g.\ its permissions or timestamps.
+
+ This event is currently only detected under Linux.
+
+ @since 2.9.5
+ */
+ wxFSW_EVENT_ATTRIB = 0x20,
+
/**
A warning condition arose.
more events will still be coming in the future, unlike for the error
condition below.
*/
- wxFSW_EVENT_WARNING = 0x20,
+ wxFSW_EVENT_WARNING = 0x40,
/**
An error condition arose.
and the program can stop watching the directories currently being
monitored.
*/
- wxFSW_EVENT_ERROR = 0x40,
+ wxFSW_EVENT_ERROR = 0x80,
wxFSW_EVENT_ALL = wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE |
wxFSW_EVENT_RENAME | wxFSW_EVENT_MODIFY |
- wxFSW_EVENT_ACCESS |
+ wxFSW_EVENT_ACCESS | wxFSW_EVENT_ATTRIB |
wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR
};
return "MODIFY";
case wxFSW_EVENT_ACCESS:
return "ACCESS";
+ case wxFSW_EVENT_ATTRIB: // Currently this is wxGTK-only
+ return "ATTRIBUTE";
}
return "INVALID_TYPE";
return "MODIFY";
case wxFSW_EVENT_ACCESS:
return "ACCESS";
+ case wxFSW_EVENT_ATTRIB: // Currently this is wxGTK-only
+ return "ATTRIBUTE";
}
// should never be reached!
static const int flag_mapping[][2] = {
{ wxFSW_EVENT_ACCESS, IN_ACCESS },
{ wxFSW_EVENT_MODIFY, IN_MODIFY },
+ { wxFSW_EVENT_ATTRIB, IN_ATTRIB },
{ wxFSW_EVENT_RENAME, IN_MOVE },
{ wxFSW_EVENT_CREATE, IN_CREATE },
{ wxFSW_EVENT_DELETE, IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF }
static const int flag_mapping[][2] = {
{ IN_ACCESS, wxFSW_EVENT_ACCESS }, // generated during read!
{ IN_MODIFY, wxFSW_EVENT_MODIFY },
- { IN_ATTRIB, 0 },
+ { IN_ATTRIB, wxFSW_EVENT_ATTRIB },
{ IN_CLOSE_WRITE, 0 },
{ IN_CLOSE_NOWRITE, 0 },
{ IN_OPEN, 0 },
#endif // !wxHAS_KQUEUE
#ifdef wxHAS_INOTIFY
+ CPPUNIT_TEST( TestEventAttribute );
CPPUNIT_TEST( TestSingleWatchtypeEvent );
#endif // wxHAS_INOTIFY
void TestEventModify();
void TestEventAccess();
#ifdef wxHAS_INOTIFY
+ void TestEventAttribute();
void TestSingleWatchtypeEvent();
#endif // wxHAS_INOTIFY
#if !defined(__VISUALC__) || wxCHECK_VISUALC_VERSION(7)
}
#ifdef wxHAS_INOTIFY
+// ----------------------------------------------------------------------------
+// TestEventAttribute
+// ----------------------------------------------------------------------------
+void FileSystemWatcherTestCase::TestEventAttribute()
+{
+ wxLogDebug("TestEventAttribute()");
+
+ class EventTester : public EventHandler
+ {
+ public:
+ virtual void GenerateEvent()
+ {
+ CPPUNIT_ASSERT(eg.TouchFile());
+ }
+
+ virtual wxFileSystemWatcherEvent ExpectedEvent()
+ {
+ wxFileSystemWatcherEvent event(wxFSW_EVENT_ATTRIB);
+ event.SetPath(eg.m_file);
+ event.SetNewPath(eg.m_file);
+ return event;
+ }
+ };
+
+ // we need to create a file to touch
+ EventGenerator::Get().CreateFile();
+
+ EventTester tester;
+ tester.Run();
+}
+
// ----------------------------------------------------------------------------
// TestSingleWatchtypeEvent: Watch only wxFSW_EVENT_ACCESS
// ----------------------------------------------------------------------------