Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Side by Side Diff: runtime/bin/file_system_watcher_macos.cc

Issue 110533008: Fix watch move event when path is a not a file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 static void Callback(ConstFSEventStreamRef ref, 174 static void Callback(ConstFSEventStreamRef ref,
175 void* client, 175 void* client,
176 size_t num_events, 176 size_t num_events,
177 void* event_paths, 177 void* event_paths,
178 const FSEventStreamEventFlags event_flags[], 178 const FSEventStreamEventFlags event_flags[],
179 const FSEventStreamEventId event_ids[]) { 179 const FSEventStreamEventId event_ids[]) {
180 Node* node = reinterpret_cast<Node*>(client); 180 Node* node = reinterpret_cast<Node*>(client);
181 for (size_t i = 0; i < num_events; i++) { 181 for (size_t i = 0; i < num_events; i++) {
182 char *path = reinterpret_cast<char**>(event_paths)[i]; 182 char *path = reinterpret_cast<char**>(event_paths)[i];
183 FSEvent event; 183 FSEvent event;
184 event.data.exists = File::Exists(path); 184 event.data.exists = File::GetType(path, false) != File::kDoesNotExist;
185 path += node->base_path_length(); 185 path += node->base_path_length();
186 // If path is longer the base, skip next character ('/'). 186 // If path is longer the base, skip next character ('/').
187 if (path[0] != '\0') path += 1; 187 if (path[0] != '\0') path += 1;
188 if (!node->recursive() && strstr(path, "/") != NULL) continue; 188 if (!node->recursive() && strstr(path, "/") != NULL) continue;
189 event.data.flags = event_flags[i]; 189 event.data.flags = event_flags[i];
190 memmove(event.data.path, path, strlen(path) + 1); 190 memmove(event.data.path, path, strlen(path) + 1);
191 write(node->write_fd(), event.bytes, sizeof(event)); 191 write(node->write_fd(), event.bytes, sizeof(event));
192 } 192 }
193 } 193 }
194 194
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 return events; 292 return events;
293 } 293 }
294 294
295 } // namespace bin 295 } // namespace bin
296 } // namespace dart 296 } // namespace dart
297 297
298 #endif // defined(TARGET_OS_MACOS) 298 #endif // defined(TARGET_OS_MACOS)
299 299
300 300
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698