OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library memory_file_system; | 5 library memory_file_system; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 _MemoryResource resource = _pathToResource[path]; | 157 _MemoryResource resource = _pathToResource[path]; |
158 if (resource is! _MemoryFolder) { | 158 if (resource is! _MemoryFolder) { |
159 throw new ArgumentError( | 159 throw new ArgumentError( |
160 'Folder expected at "$path" but ${resource.runtimeType} found'); | 160 'Folder expected at "$path" but ${resource.runtimeType} found'); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 void _notifyWatchers(String path, ChangeType changeType) { | 164 void _notifyWatchers(String path, ChangeType changeType) { |
165 _pathToWatchers.forEach((String watcherPath, | 165 _pathToWatchers.forEach((String watcherPath, |
166 List<StreamController<WatchEvent>> streamControllers) { | 166 List<StreamController<WatchEvent>> streamControllers) { |
167 if (posix.isWithin(watcherPath, path)) { | 167 if (watcherPath == path || posix.isWithin(watcherPath, path)) { |
168 for (StreamController<WatchEvent> streamController | 168 for (StreamController<WatchEvent> streamController |
169 in streamControllers) { | 169 in streamControllers) { |
170 streamController.add(new WatchEvent(changeType, path)); | 170 streamController.add(new WatchEvent(changeType, path)); |
171 } | 171 } |
172 } | 172 } |
173 }); | 173 }); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 /** | 177 /** |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 bool operator ==(other) { | 461 bool operator ==(other) { |
462 if (runtimeType != other.runtimeType) { | 462 if (runtimeType != other.runtimeType) { |
463 return false; | 463 return false; |
464 } | 464 } |
465 return path == other.path; | 465 return path == other.path; |
466 } | 466 } |
467 | 467 |
468 @override | 468 @override |
469 String toString() => path; | 469 String toString() => path; |
470 } | 470 } |
OLD | NEW |