[Mono-list] FileSystemWatcher difference between mono and .Net

Daniel Lo Nigro lists at dan.cx
Fri Nov 9 03:49:57 UTC 2012

>From looking at the code, it appears that this is only the case on some
platforms (including Windows). The Linux implementation of
FileSystemWatcher uses inotify and appears to handle renaming of files.

Default implementation:
Linux (inotify) implementation:
for "rename" in this file)

On Fri, Nov 9, 2012 at 2:03 PM, edward.harvey.mono <
edward.harvey.mono at clevertrove.com> wrote:

>  I don't know if anyone will care, but I observed a difference in
> behavior between mono 2.10.9 on windows, and .Net 4.0.****
> ** **
> When you rename a file, in mono, FileSystemWatcher triggers a
> WatcherChangeTypes.Created and WatcherChangeTypes.Deleted event.****
> In .Net, it triggers a WatcherChangeTypes.Renamed event.****
> ** **
> While it is conceivable in some cases you might prefer to have the Created
> & Deleted events, there's one really solid situation *not* to want that.  If
> you are using FileSystemWatcher to keep some directory mirrored, following
> changes of some source directory, then Created & Deleted events mean you
> have to copy the file from source to destination and delete the old one.  Whereas,
> a Renamed event can be replicated for much lower cost; all you need to do
> is perform the Rename operation on the destination.****
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20121109/52c893d3/attachment.html>

More information about the Mono-list mailing list