diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-03-12 03:33:26 +0300 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2009-03-12 03:33:26 +0300 |
commit | 27589b59b90f81fb88ab69eee320449c8cf65780 (patch) | |
tree | e57e82e990e815940525471558407287dd7d9217 | |
parent | 8f4c7c9e1aaf6568410e2a6db68ee807204b95e7 (diff) |
2009-03-11 Gonzalo Paniagua Javier <gonzalo@novell.com>mono-2.4
* InotifyWatcher.cs: don't send events when a directory is created
unless it matches the pattern. Fixes bug #484082.
svn path=/branches/mono-2-4-0/mcs/; revision=129114
-rw-r--r-- | mcs/class/System/System.IO/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System/System.IO/InotifyWatcher.cs | 25 |
2 files changed, 19 insertions, 11 deletions
diff --git a/mcs/class/System/System.IO/ChangeLog b/mcs/class/System/System.IO/ChangeLog index 3d4e250d84e..efca2b10dad 100644 --- a/mcs/class/System/System.IO/ChangeLog +++ b/mcs/class/System/System.IO/ChangeLog @@ -1,3 +1,8 @@ +2009-03-11 Gonzalo Paniagua Javier <gonzalo@novell.com> + + * InotifyWatcher.cs: don't send events when a directory is created + unless it matches the pattern. Fixes bug #484082. + 2009-01-26 Marek Habersack <mhabersack@novell.com> * SearchPattern.cs: make IsMatch work for situations when there is diff --git a/mcs/class/System/System.IO/InotifyWatcher.cs b/mcs/class/System/System.IO/InotifyWatcher.cs index f807782ed28..e636da2b30e 100644 --- a/mcs/class/System/System.IO/InotifyWatcher.cs +++ b/mcs/class/System/System.IO/InotifyWatcher.cs @@ -291,10 +291,12 @@ namespace System.IO { if (justcreated) { lock (fsw) { RenamedEventArgs renamed = null; - fsw.DispatchEvents (FileAction.Added, directory, ref renamed); - if (fsw.Waiting) { - fsw.Waiting = false; - System.Threading.Monitor.PulseAll (fsw); + if (fsw.Pattern.IsMatch (directory)) { + fsw.DispatchEvents (FileAction.Added, directory, ref renamed); + if (fsw.Waiting) { + fsw.Waiting = false; + System.Threading.Monitor.PulseAll (fsw); + } } } } @@ -311,14 +313,15 @@ namespace System.IO { foreach (string filename in Directory.GetFiles (data.Directory)) { lock (fsw) { RenamedEventArgs renamed = null; + if (fsw.Pattern.IsMatch (filename)) { + fsw.DispatchEvents (FileAction.Added, filename, ref renamed); + /* If a file has been created, then it has been written to */ + fsw.DispatchEvents (FileAction.Modified, filename, ref renamed); - fsw.DispatchEvents (FileAction.Added, filename, ref renamed); - /* If a file has been created, then it has been written to */ - fsw.DispatchEvents (FileAction.Modified, filename, ref renamed); - - if (fsw.Waiting) { - fsw.Waiting = false; - System.Threading.Monitor.PulseAll(fsw); + if (fsw.Waiting) { + fsw.Waiting = false; + System.Threading.Monitor.PulseAll(fsw); + } } } } |