@@ -266,12 +266,16 @@ class _WindowsDirectoryWatcher
266266
267267    for  (var  event in  batch) {
268268      if  (event is  FileSystemMoveEvent ) {
269+         addEvent (
270+             event.path, FileSystemDeleteEvent (event.path, event.isDirectory));
269271        var  destination =  event.destination;
270272        if  (destination !=  null ) {
271-           addEvent (destination, event);
273+           addEvent (destination,
274+               FileSystemCreateEvent (event.path, event.isDirectory));
272275        }
276+       } else  {
277+         addEvent (event.path, event);
273278      }
274-       addEvent (event.path, event);
275279    }
276280
277281    return  eventsForPaths;
@@ -280,6 +284,9 @@ class _WindowsDirectoryWatcher
280284  /// Returns the canonical event from a batch of events on the same path, if 
281285  /// one exists. 
282286  /// 
287+   /// The batch must be an output of [_sortEvents]  which guarantees it contains 
288+   /// no [FileSystemMoveEvent] s. 
289+   /// 
283290  /// If [batch]  doesn't contain any contradictory events (e.g. DELETE and 
284291  /// CREATE, or events with different values for `isDirectory` ), this returns a 
285292  /// single event that describes what happened to the path in question. 
@@ -306,9 +313,7 @@ class _WindowsDirectoryWatcher
306313      // (respectively) that will be contradictory. 
307314      if  (event is  FileSystemModifyEvent ) continue ;
308315      assert (
309-         event is  FileSystemCreateEvent  || 
310-             event is  FileSystemDeleteEvent  || 
311-             event is  FileSystemMoveEvent ,
316+         event is  FileSystemCreateEvent  ||  event is  FileSystemDeleteEvent ,
312317      );
313318
314319      // If we previously thought this was a MODIFY, we now consider it to be a 
@@ -320,9 +325,7 @@ class _WindowsDirectoryWatcher
320325
321326      // A CREATE event contradicts a REMOVE event and vice versa. 
322327      assert (
323-         type ==  FileSystemEvent .create || 
324-             type ==  FileSystemEvent .delete || 
325-             type ==  FileSystemEvent .move,
328+         type ==  FileSystemEvent .create ||  type ==  FileSystemEvent .delete,
326329      );
327330      if  (type !=  event.type) return  null ;
328331    }
@@ -334,8 +337,6 @@ class _WindowsDirectoryWatcher
334337        return  FileSystemDeleteEvent (batch.first.path, isDir);
335338      case  FileSystemEvent .modify: 
336339        return  FileSystemModifyEvent (batch.first.path, isDir, false );
337-       case  FileSystemEvent .move: 
338-         return  null ;
339340      default : 
340341        throw  StateError ('unreachable' );
341342    }
0 commit comments