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 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 /** | 43 /** |
44 * A `dart:io` based implementation of [File]. | 44 * A `dart:io` based implementation of [File]. |
45 */ | 45 */ |
46 class _PhysicalFile extends _PhysicalResource implements File { | 46 class _PhysicalFile extends _PhysicalResource implements File { |
47 _PhysicalFile(io.File file) : super(file); | 47 _PhysicalFile(io.File file) : super(file); |
48 | 48 |
49 @override | 49 @override |
50 Source createSource(UriKind uriKind) { | 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 return new FileBasedSource.con2(javaFile, uriKind); | 53 if (uri == null) { |
| 54 uri = javaFile.toURI(); |
| 55 } |
| 56 return new FileBasedSource.con2(uri, javaFile); |
54 } | 57 } |
55 } | 58 } |
56 | 59 |
57 | 60 |
58 /** | 61 /** |
59 * A `dart:io` based implementation of [Folder]. | 62 * A `dart:io` based implementation of [Folder]. |
60 */ | 63 */ |
61 class _PhysicalFolder extends _PhysicalResource implements Folder { | 64 class _PhysicalFolder extends _PhysicalResource implements Folder { |
62 _PhysicalFolder(io.Directory directory) : super(directory); | 65 _PhysicalFolder(io.Directory directory) : super(directory); |
63 | 66 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 bool operator ==(other) { | 130 bool operator ==(other) { |
128 if (runtimeType != other.runtimeType) { | 131 if (runtimeType != other.runtimeType) { |
129 return false; | 132 return false; |
130 } | 133 } |
131 return path == other.path; | 134 return path == other.path; |
132 } | 135 } |
133 | 136 |
134 @override | 137 @override |
135 String toString() => path; | 138 String toString() => path; |
136 } | 139 } |
OLD | NEW |