I have a problem. I have written a wrapper over FileSystemWatcher
that detects changes in root folder and all of its subfolders. Nothing fancy:
FileSystemWatcher watcher = new FileSystemWatcher ();
watcher.Path = this.Root;
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.DirectoryName | NotifyFilters.FileName;
watcher.Changed += new FileSystemEventHandler (watcher_Changed);
watcher.Deleted += new FileSystemEventHandler (watcher_Deleted);
watcher.Created += new FileSystemEventHandler (watcher_Created);
watcher.Renamed += new RenamedEventHandler (watcher_Renamed);
watcher.EnableRaisingEvents = true;
While in .NET, under Windows, it works like a charm. But when I ported the code to mono and ran the code under OSX, it works properly only in the root folder.
Issues I have noticed by now:
Events are not raised for operations within folders already existing under root at the time the watcher starts
Paths I get via
EventArgs.FullPath
property are not correct (when I copy a file to path_to_root/some/more/subdirs/some.file, the path I get is just path_to_root/some.file).
The issue with unproper paths has been already reported one year ago (and looks like it was solved) but my mono comes from December last year (MonoDevelop says in References section it is version 4.0.0.0, it is all I can say about the distribution) and the bugs are still there... See: https://bugzilla.xamarin.com/show_bug.cgi?id=5747
Any ideas? I am really curious if there is a workaround not requiring writing own watcher that polls the file system repeatedly or starting separate watcher for every folder under root...
Thanks in advance!