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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return resolved.toString(); | 81 return resolved.toString(); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 String _filePathFromUri(String userUri) { | 85 String _filePathFromUri(String userUri) { |
86 var uri = new Uri.fromString(userUri); | 86 var uri = new Uri.fromString(userUri); |
87 _logResolution("# Getting file path from: $uri"); | 87 _logResolution("# Getting file path from: $uri"); |
88 | 88 |
89 var path; | 89 var path; |
90 switch (uri.scheme) { | 90 switch (uri.scheme) { |
91 case 'file': path = _filePathFromFileUri(uri); break; | 91 case 'file': |
92 case 'dart-ext': path = _filePathFromOtherUri(uri); break; | 92 path = _filePathFromFileUri(uri); |
93 case 'package': path = _filePathFromPackageUri(uri); break; | 93 break; |
94 | 94 case 'dart-ext': |
95 default: | 95 path = _filePathFromOtherUri(uri); |
96 // Only handling file, dart-ext and package URIs in standalone binary. | 96 break; |
97 _logResolution("# Not a file, dart-ext, or package URI."); | 97 case 'package': |
98 throw "Not a known scheme: $uri"; | 98 path = _filePathFromPackageUri(uri); |
| 99 break; |
| 100 default: |
| 101 // Only handling file and package URIs in standalone binary. |
| 102 _logResolution("# Unknown scheme (${uri.scheme}) in $uri."); |
| 103 throw "Not a known scheme: $uri"; |
99 } | 104 } |
100 | 105 |
101 if (_is_windows) { | 106 if (_is_windows) { |
102 // Drop the leading / before the drive letter. | 107 // Drop the leading / before the drive letter. |
103 path = path.substring(1); | 108 path = path.substring(1); |
104 _logResolution("# path: $path"); | 109 _logResolution("# path: $path"); |
105 } | 110 } |
106 | 111 |
107 return path; | 112 return path; |
108 } | 113 } |
(...skipping 23 matching lines...) Expand all Loading... |
132 var wrong = 'package://$path'; | 137 var wrong = 'package://$path'; |
133 | 138 |
134 throw "URIs using the 'package:' scheme should look like " + | 139 throw "URIs using the 'package:' scheme should look like " + |
135 "'$right', not '$wrong'."; | 140 "'$right', not '$wrong'."; |
136 } | 141 } |
137 | 142 |
138 var path = _entrypoint.resolve('packages/${uri.path}').path; | 143 var path = _entrypoint.resolve('packages/${uri.path}').path; |
139 _logResolution("# Package: $path"); | 144 _logResolution("# Package: $path"); |
140 return path; | 145 return path; |
141 } | 146 } |
OLD | NEW |