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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | tests/standalone/standalone.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index b5f9a3d7028f95da2a83df1d7e88b59fd57f8fcf..c247819a2f6393ac2a0ba003e9e97c1482c3a56a 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -90,15 +90,24 @@ String _filePathFromUri(String userUri) {
var uri = new Uri.fromString(userUri);
_logResolution("# Getting file path from: $uri");
+ var path;
switch (uri.scheme) {
- case 'file': return _filePathFromFileUri(uri);
- case 'package': return _filePathFromPackageUri(uri);
+ case 'file': path = _filePathFromFileUri(uri); break;
+ case 'package': path = _filePathFromPackageUri(uri); break;
default:
// Only handling file and package URIs in standalone binary.
_logResolution("# Not a file or package URI.");
throw "Not a known scheme: $uri";
}
+
+ if (_is_windows) {
+ // Drop the leading / before the drive letter.
+ path = path.substring(1);
+ _logResolution("# path: $path");
+ }
+
+ return path;
}
String _filePathFromFileUri(Uri uri) {
@@ -106,13 +115,22 @@ String _filePathFromFileUri(Uri uri) {
throw "URIs using the 'file:' scheme may not contain a domain.";
}
- var path = uri.path;
- _logResolution("# Path: $path");
- if (_is_windows) {
- // Drop the leading / before the drive letter.
- path = path.substring(1);
- _logResolution("# path: $path");
+ _logResolution("# Path: ${uri.path}");
+ return uri.path;
+}
+
+String _filePathFromPackageUri(Uri uri) {
+ if (uri.domain != '') {
+ var path = (uri.path != '') ? '${uri.domain}${uri.path}' : uri.domain;
+ var right = 'package:$path';
+ var wrong = 'package://$path';
+
+ throw "URIs using the 'package:' scheme should look like " +
+ "'$right', not '$wrong'.";
}
+
+ var path = _entrypoint.resolve('packages/${uri.path}').path;
+ _logResolution("# Package: $path");
return path;
}
« 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