whesse@google.com 2013-11-04 07:25:57 +00:00
parent a41a1f597a
commit 3787f6d00e
5 changed files with 25 additions and 6 deletions

View file

@ -80,12 +80,20 @@ class Platform {
static String get executable => _Platform.executable;
/**
* Returns the URI of the script being run in this
* isolate. If the URI is relative it is relative to the file URI of
* the working directory of the VM when it was started.
* Returns the absolute URI of the script being run in this
* isolate.
*
* If the script argument on the command line is relative,
* it is resolved to an absolute URI before fetching the script, and
* this absolute URI is returned.
*
* URI resolution only does string manipulation on the script path, and this
* may be different from the file system's path resolution behavior. For
* example, a symbolic link immediately followed by '..' will not be
* looked up.
*
* If the executable environment does not support [script] an empty
* URI is returned.
* [Uri] is returned.
*/
static Uri get script => _Platform.script;

View file

@ -27,7 +27,7 @@ class _Platform {
s.startsWith('file:')) {
return Uri.parse(s);
} else {
return new Uri.file(s);
return Uri.base.resolveUri(new Uri.file(s));
}
}

View file

@ -5,5 +5,8 @@
import "dart:io";
main(List<String> arguments) {
if (!Platform.script.isAbsolute) {
throw "Platform.script is not absolute: ${Platform.script}";
}
print(Platform.environment[arguments[0]]);
}

View file

@ -20,6 +20,14 @@ runEnvironmentProcess(Map environment, name, includeParent, callback) {
environment: environment,
includeParentEnvironment: includeParent)
.then((result) {
if (result.exitCode != 0) {
print('print_env.dart subprocess failed '
'with exit code ${result.exitCode}');
print('stdout:');
print(result.stdout);
print('stderr:');
print(result.stderr);
}
Expect.equals(0, result.exitCode);
callback(result.stdout);
});

View file

@ -116,7 +116,7 @@ void main(List<String> args) {
// TODO(amouravski): move HtmlDiff inside of the future chain below to re-use
// the MirrorSystem already analyzed.
_diff = new HtmlDiff(printWarnings:false);
Future htmlDiff = _diff.run(currentDirectory.resolve(libPath));
Future htmlDiff = _diff.run(currentDirectory.resolveUri(path.toUri(libPath)));
// TODO(johnniwinther): Libraries for the compilation seem to be more like
// URIs. Perhaps Path should have a toURI() method.