| 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 // Corelib 'print' implementation. | 7 // Corelib 'print' implementation. |
| 8 void _print(arg) { | 8 void _print(arg) { |
| 9 _Logger._printString(arg.toString()); | 9 _Logger._printString(arg.toString()); |
| 10 } | 10 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 switch (uri.scheme) { | 99 switch (uri.scheme) { |
| 100 case 'file': | 100 case 'file': |
| 101 path = _filePathFromFileUri(uri); | 101 path = _filePathFromFileUri(uri); |
| 102 break; | 102 break; |
| 103 case 'dart-ext': | 103 case 'dart-ext': |
| 104 path = _filePathFromOtherUri(uri); | 104 path = _filePathFromOtherUri(uri); |
| 105 break; | 105 break; |
| 106 case 'package': | 106 case 'package': |
| 107 path = _filePathFromPackageUri(uri); | 107 path = _filePathFromPackageUri(uri); |
| 108 break; | 108 break; |
| 109 case 'http': |
| 110 path = _filePathFromHttpUri(uri); |
| 111 break; |
| 109 default: | 112 default: |
| 110 // Only handling file and package URIs in standalone binary. | 113 // Only handling file and package URIs in standalone binary. |
| 111 _logResolution("# Unknown scheme (${uri.scheme}) in $uri."); | 114 _logResolution("# Unknown scheme (${uri.scheme}) in $uri."); |
| 112 throw "Not a known scheme: $uri"; | 115 throw "Not a known scheme: $uri"; |
| 113 } | 116 } |
| 114 | 117 |
| 115 if (isWindows && path.startsWith("/")) { | 118 if (isWindows && path.startsWith("/")) { |
| 116 // For Windows we need to massage the paths a bit according to | 119 // For Windows we need to massage the paths a bit according to |
| 117 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx | 120 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx |
| 118 // | 121 // |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 var path; | 158 var path; |
| 156 if (_packageRoot != null) { | 159 if (_packageRoot != null) { |
| 157 path = "${_packageRoot}${uri.path}"; | 160 path = "${_packageRoot}${uri.path}"; |
| 158 } else { | 161 } else { |
| 159 path = _entrypoint.resolve('packages/${uri.path}').path; | 162 path = _entrypoint.resolve('packages/${uri.path}').path; |
| 160 } | 163 } |
| 161 | 164 |
| 162 _logResolution("# Package: $path"); | 165 _logResolution("# Package: $path"); |
| 163 return path; | 166 return path; |
| 164 } | 167 } |
| 168 |
| 169 String _filePathFromHttpUri(Uri uri) { |
| 170 _logResolution('# Path: $uri'); |
| 171 return uri.toString(); |
| 172 } |
| 173 |
| 174 String _pathFromHttpUri(String userUri) { |
| 175 var uri = Uri.parse(userUri); |
| 176 return uri.path; |
| 177 } |
| 178 |
| 179 String _domainFromHttpUri(String userUri) { |
| 180 var uri = Uri.parse(userUri); |
| 181 return uri.domain; |
| 182 } |
| 183 |
| 184 int _portFromHttpUri(String userUri) { |
| 185 var uri = Uri.parse(userUri); |
| 186 return uri.port == 0 ? 80 : uri.port; |
| 187 } |
| OLD | NEW |