Chromium Code Reviews| Index: runtime/bin/builtin.dart |
| diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart |
| index e0108096f6c8934346edbf6b103b0ea3dfe26d75..0b58d4300c0d28241e1b6e00ce63dc4a4ea4d79e 100644 |
| --- a/runtime/bin/builtin.dart |
| +++ b/runtime/bin/builtin.dart |
| @@ -32,6 +32,9 @@ var _is_windows; |
| // package imports can be resolved relative to it. |
| Uri _entrypoint; |
| +// The directory to look in to resolve "package:" scheme URIs. |
| +String _packageRoot; |
| + |
| void _logResolution(String msg) { |
| final enabled = false; |
| if (enabled) { |
| @@ -39,6 +42,15 @@ void _logResolution(String msg) { |
| } |
| } |
| +String _setPackageRoot(String packageRoot) { |
| + // Note, on Windows we require use of forward slash, and do not |
| + // support backslash. |
|
Ivan Posva
2012/04/26 05:32:09
If you check a couple of lines below, there is exa
siva
2012/04/26 13:57:54
It is not just the backslash that is a problem. Co
mattsh
2012/04/26 17:52:02
If it's OK, I'll put in a TODO now, because I thin
|
| + if (!packageRoot.endsWith("/")) { |
| + packageRoot += "/"; |
|
siva
2012/04/25 23:26:12
The '+' operator has been deprecated and is being
mattsh
2012/04/26 17:52:02
Done.
|
| + } |
| + _packageRoot = packageRoot; |
| +} |
| + |
| String _resolveScriptUri(String cwd, String scriptName, bool windows) { |
| _is_windows = windows; |
| _logResolution("# Current working directory: $cwd"); |
| @@ -141,7 +153,13 @@ String _filePathFromPackageUri(Uri uri) { |
| "'$right', not '$wrong'."; |
| } |
| - var path = _entrypoint.resolve('packages/${uri.path}').path; |
| + String path; |
|
Ivan Posva
2012/04/26 05:32:09
No types for locals. Please preserve the style of
mattsh
2012/04/26 17:52:02
Done.
|
| + if (_packageRoot !== null) { |
| + path = _packageRoot + uri.path; |
|
siva
2012/04/25 23:26:12
Ditto comment regarding '+' operator.
mattsh
2012/04/26 17:52:02
Done.
|
| + } else { |
| + path = _entrypoint.resolve('packages/${uri.path}').path; |
| + } |
| + |
| _logResolution("# Package: $path"); |
| return path; |
| } |