diff options
-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); + } } } } |