Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 builtin; | 5 library builtin; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 // import 'root_library'; happens here from C Code | 8 // import 'root_library'; happens here from C Code |
| 9 | 9 |
| 10 // The root library (aka the script) is imported into this library. The | 10 // The root library (aka the script) is imported into this library. The |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 String _resolveUri(String base, String userString) { | 209 String _resolveUri(String base, String userString) { |
| 210 var baseUri = Uri.parse(base); | 210 var baseUri = Uri.parse(base); |
| 211 _logResolution('# Resolving: $userString from $base'); | 211 _logResolution('# Resolving: $userString from $base'); |
| 212 | 212 |
| 213 var uri = Uri.parse(userString); | 213 var uri = Uri.parse(userString); |
| 214 var resolved; | 214 var resolved; |
| 215 if ('dart-ext' == uri.scheme) { | 215 if ('dart-ext' == uri.scheme) { |
| 216 // Relative URIs with scheme dart-ext should be resolved as if with no | 216 // Relative URIs with scheme dart-ext should be resolved as if with no |
| 217 // scheme. | 217 // scheme. |
| 218 resolved = baseUri.resolve(uri.path); | 218 resolved = baseUri.resolve(uri.path); |
| 219 var path = resolved.path; | |
| 220 if (resolved.scheme == 'package') { | 219 if (resolved.scheme == 'package') { |
| 221 // If we are resolving relative to a package URI we go directly to the | 220 // If we are resolving relative to a package URI we go directly to the |
| 222 // file path and keep the dart-ext scheme. Otherwise, we will lose the | 221 // file path and keep the dart-ext scheme. Otherwise, we will lose the |
| 223 // package URI path part. | 222 // package URI path part. |
| 224 path = _filePathFromPackageUri(resolved); | 223 resolved = new Uri.file(_filePathFromPackageUri(resolved)); |
|
kustermann
2014/01/28 21:58:38
I thought you can have package roots which are HTT
Bill Hesse
2014/01/28 22:55:40
Yes. It was also broken earlier, but I have chang
| |
| 225 } | 224 } |
| 226 resolved = new Uri(scheme: 'dart-ext', path: path); | 225 resolved = new Uri(scheme: 'dart-ext', path: resolved.path); |
| 227 } else { | 226 } else { |
| 228 resolved = baseUri.resolve(userString); | 227 resolved = baseUri.resolve(userString); |
| 229 } | 228 } |
| 230 _logResolution('# Resolved to: $resolved'); | 229 _logResolution('# Resolved to: $resolved'); |
| 231 return resolved.toString(); | 230 return resolved.toString(); |
| 232 } | 231 } |
| 233 | 232 |
| 234 | 233 |
| 235 // Returns either a file path or a URI starting with http:, as a String. | 234 // Returns either a file path or a URI starting with http:, as a String. |
| 236 String _filePathFromUri(String userUri) { | 235 String _filePathFromUri(String userUri) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 | 271 |
| 273 throw "URIs using the 'package:' scheme should look like " | 272 throw "URIs using the 'package:' scheme should look like " |
| 274 "'$right', not '$wrong'."; | 273 "'$right', not '$wrong'."; |
| 275 } | 274 } |
| 276 | 275 |
| 277 var packageRoot = _packageRoot == null ? | 276 var packageRoot = _packageRoot == null ? |
| 278 _entryPointScript.resolve('packages/') : | 277 _entryPointScript.resolve('packages/') : |
| 279 _packageRoot; | 278 _packageRoot; |
| 280 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); | 279 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); |
| 281 } | 280 } |
| OLD | NEW |