Improve handling of file spec in wxFileSystemWatcher::AddTree().

Fix watching too many files (i.e. even those not matching the provided spec)
and asserts when removing a recursive watch with a file spec in wxMSW.

Closes #14488.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-15 01:08:13 +00:00
parent 0f3d125b1a
commit 227dee95e0
3 changed files with 118 additions and 38 deletions

View File

@@ -200,8 +200,11 @@ public:
{
}
wxFSWatchInfo(const wxString& path, int events, wxFSWPathType type) :
m_path(path), m_events(events), m_type(type)
wxFSWatchInfo(const wxString& path,
int events,
wxFSWPathType type,
const wxString& filespec = wxString()) :
m_path(path), m_filespec(filespec), m_events(events), m_type(type)
{
}
@@ -210,6 +213,8 @@ public:
return m_path;
}
const wxString& GetFilespec() const { return m_filespec; }
int GetFlags() const
{
return m_events;
@@ -222,6 +227,7 @@ public:
protected:
wxString m_path;
wxString m_filespec; // For tree watches, holds any filespec to apply
int m_events;
wxFSWPathType m_type;
};
@@ -260,7 +266,7 @@ public:
* of particular type.
*/
virtual bool AddTree(const wxFileName& path, int events = wxFSW_EVENT_ALL,
const wxString& filter = wxEmptyString);
const wxString& filespec = wxEmptyString);
/**
* Removes path from the list of watched paths.
@@ -310,7 +316,8 @@ public:
//
// Delegates the real work of adding the path to wxFSWatcherImpl::Add() and
// updates m_watches if the new path was successfully added.
bool AddAny(const wxFileName& path, int events, wxFSWPathType type);
bool AddAny(const wxFileName& path, int events, wxFSWPathType type,
const wxString& filespec = wxString());
protected: