c# - FileSystemWatcher under mono - watching subdirs -


i have problem. have written wrapper on filesystemwatcher detects changes in root folder , of 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, works charm. when ported code mono , ran code under osx, works in root folder.

issues have noticed now:

  • events not raised operations within folders existing under root @ time watcher starts

  • paths via eventargs.fullpath property not correct (when copy file path_to_root/some/more/subdirs/some.file, path path_to_root/some.file).

the issue unproper paths has been reported 1 year ago (and looks solved) mono comes december last year (monodevelop says in references section version 4.0.0.0, can distribution) , bugs still there... see: https://bugzilla.xamarin.com/show_bug.cgi?id=5747

any ideas? curious if there workaround not requiring writing own watcher polls file system repeatedly or starting separate watcher every folder under root...

thanks in advance!

as far can tell, not work in mono on os x. encountered last week , not find bug report it, reported here: https://bugzilla.xamarin.com/show_bug.cgi?id=16259

as far can follow implementation of keventwatcher, doesn't subscribe subdirectories when watcher created. think time subscribes subdirectories when detects them being added in postevent. if did subscribe subdirectories on creation, might not great solution. underlying kevent mechanism require open file descriptor every subdirectory, end being awful lot of file descriptors.

mono have other implementations of filesystemwatcher, believe selection of implementation baked mono runtime when it's compiled. there slow , inefficient default watcher works on platforms scanning entire directory tree every second or so, selected if there isn't platform-specific implementation available.

i'm afraid say, looks best bet either of workarounds suggest - scanning changes manually or creating filesystemwatcher every directory.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -