X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d98a58c543948d84d9287e6fa53a5539d662b7a5..23dd0dcea96a6ac281cda9e861c6675b4ae53d15:/include/wx/private/fswatcher.h?ds=sidebyside diff --git a/include/wx/private/fswatcher.h b/include/wx/private/fswatcher.h index e106e6c926..4b7a894428 100644 --- a/include/wx/private/fswatcher.h +++ b/include/wx/private/fswatcher.h @@ -49,8 +49,13 @@ public: virtual bool Add(const wxFSWatchInfo& winfo) { - wxCHECK_MSG( m_watches.find(winfo.GetPath()) == m_watches.end(), false, - "Path '%s' is already watched"); + if ( m_watches.find(winfo.GetPath()) != m_watches.end() ) + { + wxLogTrace(wxTRACE_FSWATCHER, + "Path '%s' is already watched", winfo.GetPath()); + // This can happen if a dir is watched, then a parent tree added + return true; + } // construct watch entry wxSharedPtr watch(new wxFSWatchEntry(winfo)); @@ -66,8 +71,13 @@ public: virtual bool Remove(const wxFSWatchInfo& winfo) { wxFSWatchEntries::iterator it = m_watches.find(winfo.GetPath()); - wxCHECK_MSG( it != m_watches.end(), false, "Path '%s' is not watched"); - + if ( it == m_watches.end() ) + { + wxLogTrace(wxTRACE_FSWATCHER, + "Path '%s' is not watched", winfo.GetPath()); + // This can happen if a dir is watched, then a parent tree added + return true; + } wxSharedPtr watch = it->second; m_watches.erase(it); return DoRemove(watch); @@ -79,6 +89,12 @@ public: return true; } + // Check whether any filespec matches the file's ext (if present) + bool MatchesFilespec(const wxFileName& fn, const wxString& filespec) const + { + return filespec.empty() || wxMatchWild(filespec, fn.GetFullName()); + } + protected: virtual bool DoAdd(wxSharedPtr watch) = 0;