Check for filespec when generating events in wxFileSystemWatcher.

Instead of setting watches on individual files when a non-empty filespec is
given, always watch all the files but just ignore the events from the ones not
matching the filespec. This makes the code simpler and fixes several bugs.

See #14544.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-10-15 01:09:25 +00:00
parent c063adebba
commit 6eef5763a8
5 changed files with 61 additions and 57 deletions

View File

@@ -713,8 +713,8 @@ void FileSystemWatcherTestCase::TestTrees()
#ifndef __WINDOWS__
// When there's no file mask, wxMSW sets a single watch
// on the trunk which is implemented recursively.
// wxGTK always sets an additional watch for each file/subdir
treeitems += (subdirs*files) + subdirs + 1; // +1 for 'child'
// wxGTK always sets an additional watch for each subdir
treeitems += subdirs + 1; // +1 for 'child'
#endif // __WINDOWS__
// Store the initial count; there may already be some watches
@@ -761,9 +761,9 @@ void FileSystemWatcherTestCase::TestTrees()
const int initial = m_watcher->GetWatchedPathsCount();
// When we use a filter, both wxMSW and wxGTK implementations set
// an additional watch for each file/subdir. Test by passing *.txt
// We expect the dirs and the other 2 files to be skipped
const size_t treeitems = subdirs + 1;
// an additional watch for each subdir (+1 for the root dir itself
// and another +1 for "child").
const size_t treeitems = subdirs + 2;
m_watcher->AddTree(dir, wxFSW_EVENT_ALL, "*.txt");
const int plustree = m_watcher->GetWatchedPathsCount();