| 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 physical_file_system; | 5 library physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_io.dart'; | 10 import 'package:analyzer/src/generated/java_io.dart'; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (uri == null) { | 91 if (uri == null) { |
| 92 uri = javaFile.toURI(); | 92 uri = javaFile.toURI(); |
| 93 } | 93 } |
| 94 return new FileBasedSource.con2(uri, javaFile); | 94 return new FileBasedSource.con2(uri, javaFile); |
| 95 } | 95 } |
| 96 | 96 |
| 97 @override | 97 @override |
| 98 bool isOrContains(String path) { | 98 bool isOrContains(String path) { |
| 99 return path == this.path; | 99 return path == this.path; |
| 100 } | 100 } |
| 101 |
| 102 @override |
| 103 String readAsStringSync() { |
| 104 try { |
| 105 io.File file = _entry as io.File; |
| 106 return file.readAsStringSync(); |
| 107 } on io.FileSystemException catch (exception) { |
| 108 throw new FileSystemException(exception.path, exception.message); |
| 109 } |
| 110 } |
| 101 } | 111 } |
| 102 | 112 |
| 103 /** | 113 /** |
| 104 * A `dart:io` based implementation of [Folder]. | 114 * A `dart:io` based implementation of [Folder]. |
| 105 */ | 115 */ |
| 106 class _PhysicalFolder extends _PhysicalResource implements Folder { | 116 class _PhysicalFolder extends _PhysicalResource implements Folder { |
| 107 _PhysicalFolder(io.Directory directory) : super(directory); | 117 _PhysicalFolder(io.Directory directory) : super(directory); |
| 108 | 118 |
| 109 @override | 119 @override |
| 110 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; | 120 Stream<WatchEvent> get changes => new DirectoryWatcher(_entry.path).events; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 bool operator ==(other) { | 205 bool operator ==(other) { |
| 196 if (runtimeType != other.runtimeType) { | 206 if (runtimeType != other.runtimeType) { |
| 197 return false; | 207 return false; |
| 198 } | 208 } |
| 199 return path == other.path; | 209 return path == other.path; |
| 200 } | 210 } |
| 201 | 211 |
| 202 @override | 212 @override |
| 203 String toString() => path; | 213 String toString() => path; |
| 204 } | 214 } |
| OLD | NEW |