| 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 | 6 |
| 7 void print(arg) { | 7 void print(arg) { |
| 8 _Logger._printString(arg.toString()); | 8 _Logger._printString(arg.toString()); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 String resolveUri(String base, String userString) { | 63 String resolveUri(String base, String userString) { |
| 64 var baseUri = new Uri.fromString(base); | 64 var baseUri = new Uri.fromString(base); |
| 65 _logResolution("# Resolving: $userString from $base"); | 65 _logResolution("# Resolving: $userString from $base"); |
| 66 var resolved = baseUri.resolve(userString); | 66 var resolved = baseUri.resolve(userString); |
| 67 _logResolution("# Resolved to: $resolved"); | 67 _logResolution("# Resolved to: $resolved"); |
| 68 return resolved.toString(); | 68 return resolved.toString(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 String resolveExtensionUri(String base, String userString) { |
| 72 var uri = new Uri.fromString(userString); |
| 73 if ("dart-ext" != uri.scheme) { |
| 74 throw "Not a Dart extension uri: $uri"; |
| 75 } |
| 76 var schemelessUri = new Uri(path: uri.path); |
| 77 var baseUri = new Uri.fromString(base); |
| 78 _logResolution("# Resolving: $userString from $base"); |
| 79 var resolved = baseUri.resolveUri(schemelessUri); |
| 80 resolved = new Uri(scheme: 'dart-ext', path: resolved.path); |
| 81 _logResolution("# Resolved to: $resolved"); |
| 82 return resolved.toString(); |
| 83 } |
| 84 |
| 71 String filePathFromUri(String userUri) { | 85 String filePathFromUri(String userUri) { |
| 72 var uri = new Uri.fromString(userUri); | 86 var uri = new Uri.fromString(userUri); |
| 73 _logResolution("# Getting file path from: $uri"); | 87 _logResolution("# Getting file path from: $uri"); |
| 74 if ("file" != uri.scheme) { | 88 if ("file" != uri.scheme) { |
| 75 // Only handling file URIs in standalone binary. | 89 // Only handling file URIs in standalone binary. |
| 76 _logResolution("# Not a file URI."); | 90 _logResolution("# Not a file URI."); |
| 77 throw "Not a file uri: $uri"; | 91 throw "Not a file uri: $uri"; |
| 78 } | 92 } |
| 79 var path = uri.path; | 93 var path = uri.path; |
| 80 _logResolution("# Path: $path"); | 94 _logResolution("# Path: $path"); |
| 81 if (_is_windows) { | 95 if (_is_windows) { |
| 82 // Drop the leading / before the drive letter. | 96 // Drop the leading / before the drive letter. |
| 83 path = path.substring(1); | 97 path = path.substring(1); |
| 84 _logResolution("# path: $path"); | 98 _logResolution("# path: $path"); |
| 85 } | 99 } |
| 86 return path; | 100 return path; |
| 87 } | 101 } |
| OLD | NEW |