[Mono-list] FileSystemWatcher

Rob Brown-Bayliss rbb@orcon.net.nz
Fri, 25 Jun 2004 11:28:49 +1200


Hi, does FileSystemWatcher form System.IO work in the current version of
mono?

I might be misunderstanding, but I thought that it triggered events
rather than waits for events?

My code:

=======================================================

FileSystemWatcher fsw = new FileSystemWatcher();
fsw.InternalBufferSize *= 10;  
fsw.Path = path_to_watch;
fsw.Filter = "";
fsw.IncludeSubdirectories = true;
			
fsw.NotifyFilter = NotifyFilters.FileName |
	NotifyFilters.Attributes |
	NotifyFilters.LastAccess |
	NotifyFilters.LastWrite |
	NotifyFilters.Size |
	NotifyFilters.CreationTime |
	NotifyFilters.DirectoryName;
								
fsw.Changed += new FileSystemEventHandler(onChanged);
fsw.Created += new FileSystemEventHandler(onCreated);
fsw.Deleted += new FileSystemEventHandler(onDeleted);
fsw.Renamed += new RenamedEventHandler(onRenamed);
fsw.Error += new ErrorEventHandler(onError);
			
fsw.EnableRaisingEvents = true;

======================================================

Now my app hangs on the last line, and from what I have read I would
expect the app to continue on, and events to be triggered if the file
system is modified.

-- 

  Rob Brown-Bayliss
  =================