mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:20:36 +00:00
Return an absolute URI for Platform.script.
BUG= R=ajohnsen@google.com, sgjesse@google.com Committed: https://code.google.com/p/dart/source/detail?r=29740 Reverted: https://code.google.com/p/dart/source/detail?r=29742 Review URL: https://codereview.chromium.org//46163009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29792 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
a41a1f597a
commit
3787f6d00e
|
@ -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;
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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]]);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue