| 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 file_system; | 5 library file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:path/path.dart'; | 10 import 'package:path/path.dart'; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 final ResourceProvider _provider; | 124 final ResourceProvider _provider; |
| 125 | 125 |
| 126 ResourceUriResolver(this._provider); | 126 ResourceUriResolver(this._provider); |
| 127 | 127 |
| 128 @override | 128 @override |
| 129 Source resolveAbsolute(Uri uri) { | 129 Source resolveAbsolute(Uri uri) { |
| 130 if (!_isFileUri(uri)) { | 130 if (!_isFileUri(uri)) { |
| 131 return null; | 131 return null; |
| 132 } | 132 } |
| 133 Resource resource = _provider.getResource(fromUri(uri)); | 133 Resource resource = _provider.getResource(_provider.pathContext.fromUri(uri) |
| 134 ); |
| 134 if (resource is File) { | 135 if (resource is File) { |
| 135 return resource.createSource(uri); | 136 return resource.createSource(uri); |
| 136 } | 137 } |
| 137 return null; | 138 return null; |
| 138 } | 139 } |
| 139 | 140 |
| 140 /** | 141 /** |
| 141 * Return `true` if the given URI is a `file` URI. | 142 * Return `true` if the given URI is a `file` URI. |
| 142 * | 143 * |
| 143 * @param uri the URI being tested | 144 * @param uri the URI being tested |
| 144 * @return `true` if the given URI is a `file` URI | 145 * @return `true` if the given URI is a `file` URI |
| 145 */ | 146 */ |
| 146 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; | 147 static bool _isFileUri(Uri uri) => uri.scheme == _FILE_SCHEME; |
| 147 } | 148 } |
| OLD | NEW |