OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "bin/file_system_watcher.h" | 8 #include "bin/file_system_watcher.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return DartUtils::NewDartOSError(); | 264 return DartUtils::NewDartOSError(); |
265 } | 265 } |
266 size_t path_len = strlen(e.data.path); | 266 size_t path_len = strlen(e.data.path); |
267 Dart_Handle event = Dart_NewList(4); | 267 Dart_Handle event = Dart_NewList(4); |
268 int flags = e.data.flags; | 268 int flags = e.data.flags; |
269 int mask = 0; | 269 int mask = 0; |
270 if (flags & kFSEventStreamEventFlagItemModified) mask |= kModifyContent; | 270 if (flags & kFSEventStreamEventFlagItemModified) mask |= kModifyContent; |
271 if (flags & kFSEventStreamEventFlagItemRenamed) mask |= kMove; | 271 if (flags & kFSEventStreamEventFlagItemRenamed) mask |= kMove; |
272 if (flags & kFSEventStreamEventFlagItemXattrMod) mask |= kModefyAttribute; | 272 if (flags & kFSEventStreamEventFlagItemXattrMod) mask |= kModefyAttribute; |
273 if (flags & kFSEventStreamEventFlagItemCreated) mask |= kCreate; | 273 if (flags & kFSEventStreamEventFlagItemCreated) mask |= kCreate; |
| 274 if (flags & kFSEventStreamEventFlagItemIsDir) mask |= kIsDir; |
274 if (flags & kFSEventStreamEventFlagItemRemoved) { | 275 if (flags & kFSEventStreamEventFlagItemRemoved) { |
275 if (path_len == 0) { | 276 if (path_len == 0) { |
276 // The removed path is the path being watched. | 277 // The removed path is the path being watched. |
277 mask |= kDeleteSelf; | 278 mask |= kDeleteSelf; |
278 } else { | 279 } else { |
279 mask |= kDelete; | 280 mask |= kDelete; |
280 } | 281 } |
281 } | 282 } |
282 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); | 283 Dart_ListSetAt(event, 0, Dart_NewInteger(mask)); |
283 Dart_ListSetAt(event, 1, Dart_NewInteger(1)); | 284 Dart_ListSetAt(event, 1, Dart_NewInteger(1)); |
284 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( | 285 Dart_ListSetAt(event, 2, Dart_NewStringFromUTF8( |
285 reinterpret_cast<uint8_t*>(e.data.path), path_len)); | 286 reinterpret_cast<uint8_t*>(e.data.path), path_len)); |
286 Dart_ListSetAt(event, 3, Dart_NewBoolean(true)); | 287 Dart_ListSetAt(event, 3, Dart_NewBoolean(true)); |
287 Dart_ListSetAt(events, i, event); | 288 Dart_ListSetAt(events, i, event); |
288 } | 289 } |
289 return events; | 290 return events; |
290 } | 291 } |
291 | 292 |
292 } // namespace bin | 293 } // namespace bin |
293 } // namespace dart | 294 } // namespace dart |
294 | 295 |
295 #endif // defined(TARGET_OS_MACOS) | 296 #endif // defined(TARGET_OS_MACOS) |
296 | 297 |
297 | 298 |
OLD | NEW |