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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 String _filePathFromUri(String userUri) { | 236 String _filePathFromUri(String userUri) { |
| 237 var uri = Uri.parse(userUri); | 237 var uri = Uri.parse(userUri); |
| 238 _logResolution('# Getting file path from: $uri'); | 238 _logResolution('# Getting file path from: $uri'); |
| 239 | 239 |
| 240 var path; | 240 var path; |
| 241 switch (uri.scheme) { | 241 switch (uri.scheme) { |
| 242 case '': | 242 case '': |
| 243 case 'file': | 243 case 'file': |
| 244 return uri.toFilePath(); | 244 return uri.toFilePath(); |
| 245 break; | 245 break; |
| 246 case 'dart-ext': | 246 case 'dart-ext': |
|
Søren Gjesse
2014/01/27 20:57:51
This should just be
new Uri.file(uri.path)
tha
| |
| 247 return new Uri(scheme: 'file', | 247 // Relative file URIs don't start with file:///. |
| 248 var scheme = (uri.path.startsWith('/') ? 'file' : ''); | |
| 249 return new Uri(scheme: scheme, | |
| 248 host: uri.host, | 250 host: uri.host, |
| 249 path: uri.path).toFilePath(); | 251 path: uri.path).toFilePath(); |
| 250 break; | 252 break; |
| 251 case 'package': | 253 case 'package': |
| 252 return _filePathFromPackageUri(uri); | 254 return _filePathFromPackageUri(uri); |
| 253 break; | 255 break; |
| 254 case 'http': | 256 case 'http': |
| 255 return uri.toString(); | 257 return uri.toString(); |
| 256 default: | 258 default: |
| 257 // Only handling file, dart-ext, http, and package URIs | 259 // Only handling file, dart-ext, http, and package URIs |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 270 | 272 |
| 271 throw "URIs using the 'package:' scheme should look like " | 273 throw "URIs using the 'package:' scheme should look like " |
| 272 "'$right', not '$wrong'."; | 274 "'$right', not '$wrong'."; |
| 273 } | 275 } |
| 274 | 276 |
| 275 var packageRoot = _packageRoot == null ? | 277 var packageRoot = _packageRoot == null ? |
| 276 _entryPointScript.resolve('packages/') : | 278 _entryPointScript.resolve('packages/') : |
| 277 _packageRoot; | 279 _packageRoot; |
| 278 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); | 280 return _filePathFromUri(packageRoot.resolve(uri.path).toString()); |
| 279 } | 281 } |
| OLD | NEW |