Chromium Code Reviews| Index: runtime/bin/builtin.dart |
| diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart |
| index e0108096f6c8934346edbf6b103b0ea3dfe26d75..380842c6de2d139c823cd4fc071f9f7cca164ae1 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,13 @@ void _logResolution(String msg) { |
| } |
| } |
| +String _setPackageRoot(String packageRoot) { |
| + if (!packageRoot.endsWith("/")) { |
| + packageRoot += "/"; |
| + } |
| + _packageRoot = packageRoot; |
|
siva
2012/04/22 00:14:01
will windows users specify --package_root="c:\User
mattsh
2012/04/23 16:48:09
Adding a TODO to decide about forward slashes and
siva
2012/04/23 17:16:45
We would like to not postpone windows issues for a
|
| +} |
| + |
| String _resolveScriptUri(String cwd, String scriptName, bool windows) { |
| _is_windows = windows; |
| _logResolution("# Current working directory: $cwd"); |
| @@ -141,7 +151,13 @@ String _filePathFromPackageUri(Uri uri) { |
| "'$right', not '$wrong'."; |
| } |
| - var path = _entrypoint.resolve('packages/${uri.path}').path; |
| + String path; |
|
Bob Nystrom
2012/04/20 23:23:20
Just use "var" here to be consistent with the rest
|
| + if (_packageRoot !== null) { |
| + path = _packageRoot + uri.path; |
| + } else { |
| + path = _entrypoint.resolve('packages/${uri.path}').path; |
| + } |
| + |
| _logResolution("# Package: $path"); |
| return path; |
| } |