Index: runtime/bin/file_system_watcher_macos.cc |
diff --git a/runtime/bin/file_system_watcher_macos.cc b/runtime/bin/file_system_watcher_macos.cc |
index 65ad6e9957dead2456acd0c0b9729794ce3e87cb..77fb6a9f20fa7639044e238ad50ca64d5e4aa9b1 100644 |
--- a/runtime/bin/file_system_watcher_macos.cc |
+++ b/runtime/bin/file_system_watcher_macos.cc |
@@ -267,8 +267,15 @@ Dart_Handle FileSystemWatcher::ReadEvents(intptr_t id) { |
Dart_Handle event = Dart_NewList(4); |
int flags = e.data.flags; |
int mask = 0; |
+ if (flags & kFSEventStreamEventFlagItemRenamed) { |
+ if (path_len == 0) { |
+ // The moved path is the path being watched. |
+ mask |= kDeleteSelf; |
+ } else { |
+ mask |= kMove; |
+ } |
+ } |
if (flags & kFSEventStreamEventFlagItemModified) mask |= kModifyContent; |
- if (flags & kFSEventStreamEventFlagItemRenamed) mask |= kMove; |
if (flags & kFSEventStreamEventFlagItemXattrMod) mask |= kModefyAttribute; |
if (flags & kFSEventStreamEventFlagItemCreated) mask |= kCreate; |
if (flags & kFSEventStreamEventFlagItemIsDir) mask |= kIsDir; |