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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 bool operator ==(other) { | 465 bool operator ==(other) { |
466 if (runtimeType != other.runtimeType) { | 466 if (runtimeType != other.runtimeType) { |
467 return false; | 467 return false; |
468 } | 468 } |
469 return path == other.path; | 469 return path == other.path; |
470 } | 470 } |
471 | 471 |
472 @override | 472 @override |
473 String toString() => path; | 473 String toString() => path; |
474 } | 474 } |
OLD | NEW |