diff options
Diffstat (limited to 'mcs/class/System/System.IO/InotifyWatcher.cs')
-rw-r--r-- | mcs/class/System/System.IO/InotifyWatcher.cs | 25 |
1 files changed, 14 insertions, 11 deletions
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); + } } } } |