| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 @override | 49 @override |
| 50 Source createSource([Uri uri]) { | 50 Source createSource([Uri uri]) { |
| 51 io.File file = _entry as io.File; | 51 io.File file = _entry as io.File; |
| 52 JavaFile javaFile = new JavaFile(file.absolute.path); | 52 JavaFile javaFile = new JavaFile(file.absolute.path); |
| 53 if (uri == null) { | 53 if (uri == null) { |
| 54 uri = javaFile.toURI(); | 54 uri = javaFile.toURI(); |
| 55 } | 55 } |
| 56 return new FileBasedSource.con2(uri, javaFile); | 56 return new FileBasedSource.con2(uri, javaFile); |
| 57 } | 57 } |
| 58 |
| 59 @override |
| 60 bool isOrContains(String path) { |
| 61 return path == this.path; |
| 62 } |
| 58 } | 63 } |
| 59 | 64 |
| 60 | 65 |
| 61 /** | 66 /** |
| 62 * A `dart:io` based implementation of [Folder]. | 67 * A `dart:io` based implementation of [Folder]. |
| 63 */ | 68 */ |
| 64 class _PhysicalFolder extends _PhysicalResource implements Folder { | 69 class _PhysicalFolder extends _PhysicalResource implements Folder { |
| 65 _PhysicalFolder(io.Directory directory) : super(directory); | 70 _PhysicalFolder(io.Directory directory) : super(directory); |
| 66 | 71 |
| 67 @override | 72 @override |
| (...skipping 24 matching lines...) Expand all Loading... |
| 92 for (int i = 0; i < numEntries; i++) { | 97 for (int i = 0; i < numEntries; i++) { |
| 93 io.FileSystemEntity entity = entries[i]; | 98 io.FileSystemEntity entity = entries[i]; |
| 94 if (entity is io.Directory) { | 99 if (entity is io.Directory) { |
| 95 children.add(new _PhysicalFolder(entity)); | 100 children.add(new _PhysicalFolder(entity)); |
| 96 } else if (entity is io.File) { | 101 } else if (entity is io.File) { |
| 97 children.add(new _PhysicalFile(entity)); | 102 children.add(new _PhysicalFile(entity)); |
| 98 } | 103 } |
| 99 } | 104 } |
| 100 return children; | 105 return children; |
| 101 } | 106 } |
| 107 |
| 108 @override |
| 109 bool isOrContains(String path) { |
| 110 if (path == this.path) { |
| 111 return true; |
| 112 } |
| 113 return contains(path); |
| 114 } |
| 102 } | 115 } |
| 103 | 116 |
| 104 | 117 |
| 105 /** | 118 /** |
| 106 * A `dart:io` based implementation of [Resource]. | 119 * A `dart:io` based implementation of [Resource]. |
| 107 */ | 120 */ |
| 108 abstract class _PhysicalResource implements Resource { | 121 abstract class _PhysicalResource implements Resource { |
| 109 final io.FileSystemEntity _entry; | 122 final io.FileSystemEntity _entry; |
| 110 | 123 |
| 111 _PhysicalResource(this._entry); | 124 _PhysicalResource(this._entry); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 135 bool operator ==(other) { | 148 bool operator ==(other) { |
| 136 if (runtimeType != other.runtimeType) { | 149 if (runtimeType != other.runtimeType) { |
| 137 return false; | 150 return false; |
| 138 } | 151 } |
| 139 return path == other.path; | 152 return path == other.path; |
| 140 } | 153 } |
| 141 | 154 |
| 142 @override | 155 @override |
| 143 String toString() => path; | 156 String toString() => path; |
| 144 } | 157 } |
| OLD | NEW |