| 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 analyzer.file_system.physical_file_system; | 5 library analyzer.file_system.physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * A `dart:io` based implementation of [Folder]. | 212 * A `dart:io` based implementation of [Folder]. |
| 213 */ | 213 */ |
| 214 class _PhysicalFolder extends _PhysicalResource implements Folder { | 214 class _PhysicalFolder extends _PhysicalResource implements Folder { |
| 215 _PhysicalFolder(io.Directory directory) : super(directory); | 215 _PhysicalFolder(io.Directory directory) : super(directory); |
| 216 | 216 |
| 217 @override | 217 @override |
| 218 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; | 218 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; |
| 219 | 219 |
| 220 /** |
| 221 * Return the underlying file being represented by this wrapper. |
| 222 */ |
| 223 io.Directory get _directory => _entry as io.Directory; |
| 224 |
| 220 @override | 225 @override |
| 221 String canonicalizePath(String relPath) { | 226 String canonicalizePath(String relPath) { |
| 222 return normalize(join(path, relPath)); | 227 return normalize(join(path, relPath)); |
| 223 } | 228 } |
| 224 | 229 |
| 225 @override | 230 @override |
| 226 bool contains(String path) { | 231 bool contains(String path) { |
| 227 return absolutePathContext.isWithin(this.path, path); | 232 return absolutePathContext.isWithin(this.path, path); |
| 228 } | 233 } |
| 229 | 234 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 275 |
| 271 @override | 276 @override |
| 272 bool isOrContains(String path) { | 277 bool isOrContains(String path) { |
| 273 if (path == this.path) { | 278 if (path == this.path) { |
| 274 return true; | 279 return true; |
| 275 } | 280 } |
| 276 return contains(path); | 281 return contains(path); |
| 277 } | 282 } |
| 278 | 283 |
| 279 @override | 284 @override |
| 285 Folder resolveSymbolicLinksSync() { |
| 286 try { |
| 287 return new _PhysicalFolder( |
| 288 new io.Directory(_directory.resolveSymbolicLinksSync())); |
| 289 } on io.FileSystemException catch (exception) { |
| 290 throw new FileSystemException(exception.path, exception.message); |
| 291 } |
| 292 } |
| 293 |
| 294 @override |
| 280 Uri toUri() => new Uri.directory(path); | 295 Uri toUri() => new Uri.directory(path); |
| 281 } | 296 } |
| 282 | 297 |
| 283 /** | 298 /** |
| 284 * A `dart:io` based implementation of [Resource]. | 299 * A `dart:io` based implementation of [Resource]. |
| 285 */ | 300 */ |
| 286 abstract class _PhysicalResource implements Resource { | 301 abstract class _PhysicalResource implements Resource { |
| 287 final io.FileSystemEntity _entry; | 302 final io.FileSystemEntity _entry; |
| 288 | 303 |
| 289 _PhysicalResource(this._entry); | 304 _PhysicalResource(this._entry); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 timer.cancel(); | 375 timer.cancel(); |
| 361 } | 376 } |
| 362 }); | 377 }); |
| 363 return completer.future; | 378 return completer.future; |
| 364 } | 379 } |
| 365 _isSpawning = true; | 380 _isSpawning = true; |
| 366 _runner = await IsolateRunner.spawn(); | 381 _runner = await IsolateRunner.spawn(); |
| 367 return _runner; | 382 return _runner; |
| 368 } | 383 } |
| 369 } | 384 } |
| OLD | NEW |