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:uri"); | 6 #import("dart:uri"); |
7 | 7 |
8 void print(arg) { | 8 void print(arg) { |
9 _Logger._printString(arg.toString()); | 9 _Logger._printString(arg.toString()); |
10 } | 10 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 _logResolution("# Path: ${uri.path}"); | 139 _logResolution("# Path: ${uri.path}"); |
140 return uri.path; | 140 return uri.path; |
141 } | 141 } |
142 | 142 |
143 String _filePathFromPackageUri(Uri uri) { | 143 String _filePathFromPackageUri(Uri uri) { |
144 if (uri.domain != '') { | 144 if (uri.domain != '') { |
145 var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain; | 145 var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain; |
146 var right = 'package:$path'; | 146 var right = 'package:$path'; |
147 var wrong = 'package://$path'; | 147 var wrong = 'package://$path'; |
148 | 148 |
149 throw "URIs using the 'package:' scheme should look like " + | 149 throw "URIs using the 'package:' scheme should look like " |
150 "'$right', not '$wrong'."; | 150 "'$right', not '$wrong'."; |
151 } | 151 } |
152 | 152 |
153 var path; | 153 var path; |
154 if (_packageRoot !== null) { | 154 if (_packageRoot !== null) { |
155 path = "${_packageRoot}${uri.path}"; | 155 path = "${_packageRoot}${uri.path}"; |
156 } else { | 156 } else { |
157 path = _entrypoint.resolve('packages/${uri.path}').path; | 157 path = _entrypoint.resolve('packages/${uri.path}').path; |
158 } | 158 } |
159 | 159 |
160 _logResolution("# Package: $path"); | 160 _logResolution("# Package: $path"); |
161 return path; | 161 return path; |
162 } | 162 } |
OLD | NEW |