>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:
https://github.com/mono/mono/blob/master/mcs/class/System/System.IO/DefaultWatcher.cs
Linux (inotify) implementation:
https://github.com/mono/mono/blob/master/mcs/class/System/System.IO/InotifyWatcher.cs
(search
for "rename" in this file)


On Fri, Nov 9, 2012 at 2:03 PM, edward.harvey.mono <
[email protected]> 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  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to