X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fccda2ced58ad3cef3d272777725f6f0ff3a442..cc4d5638c66a409e421420ed7110917755a66788:/src/common/fswatchercmn.cpp diff --git a/src/common/fswatchercmn.cpp b/src/common/fswatchercmn.cpp index 9891bb7f3c..1de2422183 100644 --- a/src/common/fswatchercmn.cpp +++ b/src/common/fswatchercmn.cpp @@ -3,7 +3,6 @@ // Purpose: wxMswFileSystemWatcher // Author: Bartosz Bekier // Created: 2009-05-26 -// RCS-ID: $Id$ // Copyright: (c) 2009 Bartosz Bekier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -40,6 +39,16 @@ static wxString GetFSWEventChangeTypeName(int type) return "MODIFY"; case wxFSW_EVENT_ACCESS: return "ACCESS"; + case wxFSW_EVENT_ATTRIB: // Currently this is wxGTK-only + return "ATTRIBUTE"; +#ifdef wxHAS_INOTIFY + case wxFSW_EVENT_UNMOUNT: // Currently this is wxGTK-only + return "UNMOUNT"; +#endif + case wxFSW_EVENT_WARNING: + return "WARNING"; + case wxFSW_EVENT_ERROR: + return "ERROR"; } // should never be reached! @@ -52,6 +61,8 @@ static wxString GetFSWEventChangeTypeName(int type) // wxFileSystemWatcherEvent implementation // ============================================================================ +IMPLEMENT_DYNAMIC_CLASS(wxFileSystemWatcherEvent, wxEvent); + wxString wxFileSystemWatcherEvent::ToString() const { return wxString::Format("FSW_EVT type=%d (%s) path='%s'", m_changeType, @@ -90,7 +101,10 @@ bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) } else { - wxLogError(_("Can't monitor non-existent path \"%s\" for changes."), + // Don't overreact to being passed a non-existent item. It may have + // only just been deleted, in which case doing nothing is correct + wxLogTrace(wxTRACE_FSWATCHER, + "Can't monitor non-existent path \"%s\" for changes.", path.GetFullPath()); return false; } @@ -120,7 +134,7 @@ wxFileSystemWatcherBase::AddAny(const wxFileName& path, if ( it == m_watches.end() ) { wxFSWatchInfoMap::value_type val(canonical, watch); - m_watches.insert(val).second; + m_watches.insert(val); } else { @@ -199,7 +213,7 @@ bool wxFileSystemWatcherBase::AddTree(const wxFileName& path, int events, wxDir dir(path.GetFullPath()); // Prevent asserts or infinite loops in trees containing symlinks - int flags = wxDIR_DEFAULT; // TODO: we ignore files, so why use wxDIR_FILES? + int flags = wxDIR_DIRS; if ( !path.ShouldFollowLink() ) { flags |= wxDIR_NO_FOLLOW; @@ -270,7 +284,7 @@ bool wxFileSystemWatcherBase::RemoveTree(const wxFileName& path) // infinite loops in trees containing symlinks. We need to do the same // or we'll try to remove unwatched items. Let's hope the caller used // the same ShouldFollowLink() setting as in AddTree()... - int flags = wxDIR_DEFAULT; // See the TODO in AddTree() + int flags = wxDIR_DIRS; if ( !path.ShouldFollowLink() ) { flags |= wxDIR_NO_FOLLOW;