Chromium Code Reviews| Index: lib/src/directory_watcher/mac_os.dart |
| diff --git a/lib/src/directory_watcher/mac_os.dart b/lib/src/directory_watcher/mac_os.dart |
| index e3efa2dd64bc034aaeed4b1e9369c67171a036c1..ee2013665f57335cff3a7b6e098d996257bb7062 100644 |
| --- a/lib/src/directory_watcher/mac_os.dart |
| +++ b/lib/src/directory_watcher/mac_os.dart |
| @@ -179,12 +179,15 @@ class _MacOSDirectoryWatcher implements ManuallyClosedDirectoryWatcher { |
| for (var event in events) { |
| if (event is FileSystemCreateEvent) { |
| if (!event.isDirectory) { |
| - // Don't emit ADD events for files or directories that we already |
| - // know about. Such an event comes from FSEvents reporting an add |
| - // that happened prior to the watch beginning. |
| - if (_files.contains(path)) continue; |
| - |
| - _emitEvent(ChangeType.ADD, path); |
| + // If we already know about the file, treat it like a modification. |
|
nweiz
2015/01/22 00:20:19
"treat it" -> "treat an ADD event"
|
| + // This can happen if a file is copied on top of an existing one. |
| + // We'll see an ADD event for the latter file when from the user's |
| + // perspective, the file's contents just changed. |
| + var type = _files.contains(path) |
| + ? ChangeType.MODIFY |
| + : ChangeType.ADD; |
| + |
| + _emitEvent(type, path); |
| _files.add(path); |
| continue; |
| } |