Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: runtime/bin/builtin.dart

Issue 10052021: Fix "package:" stuff on Windows and skip tests on dart2js since it doesn't support it yet. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Typo. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | tests/standalone/standalone.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 var resolved = baseUri.resolveUri(schemelessUri); 83 var resolved = baseUri.resolveUri(schemelessUri);
84 resolved = new Uri(scheme: 'dart-ext', path: resolved.path); 84 resolved = new Uri(scheme: 'dart-ext', path: resolved.path);
85 _logResolution("# Resolved to: $resolved"); 85 _logResolution("# Resolved to: $resolved");
86 return resolved.toString(); 86 return resolved.toString();
87 } 87 }
88 88
89 String _filePathFromUri(String userUri) { 89 String _filePathFromUri(String userUri) {
90 var uri = new Uri.fromString(userUri); 90 var uri = new Uri.fromString(userUri);
91 _logResolution("# Getting file path from: $uri"); 91 _logResolution("# Getting file path from: $uri");
92 92
93 var path;
93 switch (uri.scheme) { 94 switch (uri.scheme) {
94 case 'file': return _filePathFromFileUri(uri); 95 case 'file': path = _filePathFromFileUri(uri); break;
95 case 'package': return _filePathFromPackageUri(uri); 96 case 'package': path = _filePathFromPackageUri(uri); break;
96 97
97 default: 98 default:
98 // Only handling file and package URIs in standalone binary. 99 // Only handling file and package URIs in standalone binary.
99 _logResolution("# Not a file or package URI."); 100 _logResolution("# Not a file or package URI.");
100 throw "Not a known scheme: $uri"; 101 throw "Not a known scheme: $uri";
101 } 102 }
103
104 if (_is_windows) {
105 // Drop the leading / before the drive letter.
106 path = path.substring(1);
107 _logResolution("# path: $path");
108 }
109
110 return path;
102 } 111 }
103 112
104 String _filePathFromFileUri(Uri uri) { 113 String _filePathFromFileUri(Uri uri) {
105 if (uri.domain != '') { 114 if (uri.domain != '') {
106 throw "URIs using the 'file:' scheme may not contain a domain."; 115 throw "URIs using the 'file:' scheme may not contain a domain.";
107 } 116 }
108 117
109 var path = uri.path; 118 _logResolution("# Path: ${uri.path}");
110 _logResolution("# Path: $path"); 119 return uri.path;
111 if (_is_windows) { 120 }
112 // Drop the leading / before the drive letter. 121
113 path = path.substring(1); 122 String _filePathFromPackageUri(Uri uri) {
114 _logResolution("# path: $path"); 123 if (uri.domain != '') {
124 var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain;
125 var right = 'package:$path';
126 var wrong = 'package://$path';
127
128 throw "URIs using the 'package:' scheme should look like " +
129 "'$right', not '$wrong'.";
115 } 130 }
131
132 var path = _entrypoint.resolve('packages/${uri.path}').path;
133 _logResolution("# Package: $path");
116 return path; 134 return path;
117 } 135 }
118 136
119 String _filePathFromPackageUri(Uri uri) { 137 String _filePathFromPackageUri(Uri uri) {
120 if (uri.domain != '') { 138 if (uri.domain != '') {
121 var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain; 139 var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain;
122 var right = 'package:$path'; 140 var right = 'package:$path';
123 var wrong = 'package://$path'; 141 var wrong = 'package://$path';
124 142
125 throw "URIs using the 'package:' scheme should look like " + 143 throw "URIs using the 'package:' scheme should look like " +
126 "'$right', not '$wrong'."; 144 "'$right', not '$wrong'.";
127 } 145 }
128 146
129 var path = _entrypoint.resolve('packages/${uri.path}').path; 147 var path = _entrypoint.resolve('packages/${uri.path}').path;
130 _logResolution("# Package: $path"); 148 _logResolution("# Package: $path");
131 return path; 149 return path;
132 } 150 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | tests/standalone/standalone.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698