Change dart:io Platform.script to return a URI. Change all uses of Platform.script to work with the new value.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//53313007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29619 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
whesse@google.com 2013-10-31 01:08:11 +00:00
parent d5edc5c73e
commit cb0110350a
88 changed files with 267 additions and 265 deletions

View file

@ -175,7 +175,7 @@ class CommandLineOptions {
static String _getVersion() {
try {
String versionPath = join(dirname(Platform.script), '..', 'version');;
String versionPath = Platform.script.resolve('../version').toFilePath();
File versionFile = new File(versionPath);
return versionFile.readAsStringSync().trim();
} catch (_) {

View file

@ -190,7 +190,7 @@ class CoverageServer extends RewriteServer {
String rewritePathContent(String path) {
if (path.endsWith('__coverage_lib.dart')) {
String implPath = pathos.joinAll([
pathos.dirname(Platform.script),
pathos.dirname(Platform.script.toFilePath()),
'..', 'lib', 'src', 'services', 'runtime', 'coverage',
'coverage_lib.dart']);
var content = new File(implPath).readAsStringSync();

View file

@ -249,8 +249,7 @@ Future<MirrorSystem> getMirrorSystem(List<String> args, {String packageRoot,
var libraries = !parseSdk ? _listLibraries(args) : _listSdk();
if (libraries.isEmpty) throw new StateError('No Libraries.');
// Finds the root of SDK library based off the location of docgen.
var sdkRoot = path.join(path.dirname(path.dirname(path.dirname(path.dirname(
path.absolute(Platform.script))))), 'sdk');
var sdkRoot = Platform.script.resolve('../../../sdk').toFilePath();
logger.info('SDK Root: ${sdkRoot}');
return _analyzeLibraries(libraries, sdkRoot, packageRoot: packageRoot);
}
@ -479,10 +478,9 @@ void _mdnComment(Indexable item) {
//Check if MDN is loaded.
if (_mdn == null) {
// Reading in MDN related json file.
var mdnDir = path.join(path.dirname(path.dirname(path.dirname(path.dirname(
path.absolute(Platform.script))))), 'utils', 'apidoc', 'mdn');
_mdn = JSON.decode(new File(path.join(mdnDir, 'database.json'))
.readAsStringSync());
var mdnDatabase =
Platform.script.resolve('../../../utils/apidoc/mdn/database.json');
_mdn = JSON.decode(new File(mdnDatabase.toFilePath()).readAsStringSync());
}
if (item.comment.isNotEmpty) return;
var domAnnotation = item.annotations.firstWhere(

View file

@ -58,8 +58,7 @@ const CERTIFICATE = "localhost_cert";
setupSecure() {
String scriptDir = dirname(Platform.script);
String certificateDatabase = join(scriptDir, 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');
}

View file

@ -119,7 +119,7 @@ void initMetatest(message) {
/// describing the results of that test run.
Future<Map> _runInIsolate(String description) {
var replyPort = new ReceivePort();
return Isolate.spawnUri(Uri.parse(Platform.script), [], {
return Isolate.spawnUri(Platform.script, [], {
'testToRun': description,
'replyTo': replyPort.sendPort
}).then((_) {

View file

@ -365,7 +365,6 @@ ScheduledProcess startDartProcess(String script) {
'create temp dir');
var dartPath = schedule(() {
return tempDir.then((dir) {
var utilsPath = path.absolute(path.join(Platform.script, 'utils.dart'));
return new File(path.join(dir, 'test.dart')).writeAsString('''
import 'dart:async';
import 'dart:convert';

View file

@ -20,7 +20,7 @@ Map<String, TreeBuilderFactory> get treeTypes {
return _treeTypes;
}
final testDataDir = path.join(path.dirname(Platform.script), 'data');
final testDataDir = Platform.script.resolve('data').toFilePath();
Iterable<String> getDataFiles(String subdirectory) {
var dir = new Directory(path.join(testDataDir, subdirectory));

View file

@ -454,8 +454,8 @@ void fail(String message) {
Future compilerMain(List<String> arguments) {
var root = uriPathToNative("/$LIBRARY_ROOT");
arguments =
<String>['--library-root=${Platform.script}$root']..addAll(arguments);
arguments = <String>['--library-root=${Platform.script.toFilePath()}$root']
..addAll(arguments);
return compile(arguments);
}

View file

@ -60,7 +60,7 @@ main(List<String> arguments) {
output = new File(arguments.first).openSync(mode: FileMode.WRITE);
Uri myLocation =
handler.provider.cwd.resolve(nativeToUriPath(Platform.script));
handler.provider.cwd.resolveUri(Platform.script);
// Get the names of public dart2js libraries.
Iterable<String> names = LIBRARIES.keys.where(isPublicDart2jsLibrary);

View file

@ -41,7 +41,7 @@ main(List<String> arguments) {
output = new File(arguments.first).openSync(mode: FileMode.WRITE);
Uri myLocation =
handler.provider.cwd.resolve(nativeToUriPath(Platform.script));
handler.provider.cwd.resolveUri(Platform.script);
sdkRoot = myLocation.resolve(SDK_ROOT).resolve('../');

View file

@ -70,7 +70,7 @@ const API_LOCATION = 'http://api.dartlang.org/';
*/
// TODO(johnniwinther): Convert to final (lazily initialized) variables when
// the feature is supported.
String get scriptDir => path.dirname(Platform.script);
String get scriptDir => path.dirname(Platform.script.toFilePath());
/**
* Deletes and recreates the output directory at [path] if it exists.
@ -776,7 +776,7 @@ class Dartdoc {
/// Whether dartdoc is running from within the Dart SDK or the
/// Dart source repository.
bool get runningFromSdk =>
path.extension(Platform.script) == '.snapshot';
path.extension(Platform.script.toFilePath()) == '.snapshot';
/// Gets the path to the root directory of the SDK.
String get sdkDir =>

View file

@ -196,7 +196,7 @@ void _testRunDartDoc(List<String> libraryPaths, void eval(ProcessResult)) {
/// The path to the root directory of the dartdoc entrypoint.
String get _dartdocDir {
var dir = path.absolute(Platform.script);
var dir = path.absolute(Platform.script.toFilePath());
while (path.basename(dir) != 'dartdoc') {
if (!path.absolute(dir).contains('dartdoc') || dir == path.dirname(dir)) {
fail('Unable to find root dartdoc directory.');

View file

@ -381,7 +381,8 @@ void createPackageSymlink(String name, String target, String symlink,
/// Whether pub is running from within the Dart SDK, as opposed to from the Dart
/// source repository.
bool get runningFromSdk => path.extension(Platform.script) == '.snapshot';
bool get runningFromSdk =>
path.extension(Platform.script.toFilePath()) == '.snapshot';
/// Resolves [target] relative to the path to pub's `resource` directory.
String resourcePath(String target) {

View file

@ -80,14 +80,14 @@ class Platform {
static String get executable => _Platform.executable;
/**
* Returns the URI (in String form) of the script being run in this
* 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.
*
* If the executable environment does not support [script] an empty
* string is returned.
* URI is returned.
*/
static String get script => _nativeScript;
static Uri get script => _Platform.script;
/**
* Returns the flags passed to the executable used to run the script in this

View file

@ -18,6 +18,18 @@ class _Platform {
static int get numberOfProcessors => _numberOfProcessors();
static String get pathSeparator => _pathSeparator();
static String get operatingSystem => _operatingSystem();
static Uri script = _script();
static Uri _script() {
// The embedder (Dart executable) creates the Platform._nativeScript field.
var s = Platform._nativeScript;
if (s.startsWith('http:') ||
s.startsWith('https:') ||
s.startsWith('file:')) {
return Uri.parse(s);
} else {
return new Uri.file(s);
}
}
static String get localHostname {
var result = _localHostname();

View file

@ -42,7 +42,7 @@ main() {
var entrypoint = Uri.parse("file:///main.dart");
// Find the path to sdk/ in the repo relative to this script.
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -10,7 +10,7 @@ import '../../../sdk/lib/_internal/compiler/compiler.dart'
show Diagnostic;
main() {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -9,7 +9,7 @@ import 'memory_source_file_helper.dart';
Future<Map<String, String>> generate(String code,
[List<String> options = const []]) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(platformScript);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -14,7 +14,7 @@ import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
as dart2js;
void main() {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(platformScript);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -10,7 +10,7 @@ import '../../../sdk/lib/_internal/compiler/compiler.dart'
show Diagnostic;
main() {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(platformScript);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -79,7 +79,7 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
List<String> options: const [],
Compiler cachedCompiler,
bool showDiagnostics: true}) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');
@ -136,7 +136,7 @@ Future<MirrorSystem> mirrorSystemFor(Map<String,String> memorySourceFiles,
{DiagnosticHandler diagnosticHandler,
List<String> options: const [],
bool showDiagnostics: true}) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -12,7 +12,7 @@ export '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'
show Compiler;
export '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'
show currentDirectory, nativeToUriPath;
show currentDirectory;
import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'
show StringSourceFile;

View file

@ -17,7 +17,7 @@ import '../../../sdk/lib/_internal/compiler/compiler.dart'
import 'dart:async';
main() {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -8,7 +8,7 @@ import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart'
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart';
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart';
import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'
show currentDirectory, nativeToUriPath;
show currentDirectory;
import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
import 'dart:io';
@ -42,8 +42,7 @@ DeclarationMirror findMirror(Iterable<DeclarationMirror> list, String name) {
}
main() {
Uri scriptUri =
currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri scriptUri = currentDirectory.resolveUri(Platform.script);
Uri libUri = scriptUri.resolve('../../../sdk/');
Uri inputUri = scriptUri.resolve('mirrors_helper.dart');
var provider = new CompilerSourceFileProvider();

View file

@ -31,7 +31,7 @@ main() {}
};
void runCompiler(Uri main, String expectedMessage) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);

View file

@ -31,7 +31,7 @@ main() {}
};
void runCompiler(Uri main) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);

View file

@ -1,78 +1,78 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that dart2js produces the expected static type warnings for type
// promotion langauge tests. This ensures that the analyzer and dart2js agrees
// on these tests.
import 'dart:async';
import 'dart:io';
import 'package:expect/expect.dart';
import 'memory_compiler.dart';
import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart';
import 'dart:convert';
const List<String> TESTS = const [
'language/type_promotion_assign_test.dart',
'language/type_promotion_closure_test.dart',
'language/type_promotion_functions_test.dart',
'language/type_promotion_local_test.dart',
'language/type_promotion_logical_and_test.dart',
'language/type_promotion_more_specific_test.dart',
'language/type_promotion_multiple_test.dart',
'language/type_promotion_parameter_test.dart',
];
void main() {
bool isWindows = (Platform.operatingSystem == 'windows');
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
bool warningsMismatch = false;
Future.forEach(TESTS, (String test) {
Uri uri = script.resolve('../../$test');
String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
SourceFile file = new StringSourceFile(
relativize(currentDirectory, uri, isWindows), source);
Map<int,String> expectedWarnings = {};
int lineNo = 0;
for (String line in source.split('\n')) {
if (line.contains('///') && line.contains('static type warning')) {
expectedWarnings[lineNo] = line;
}
lineNo++;
}
Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys);
DiagnosticCollector collector = new DiagnosticCollector();
var compiler = compilerFor(const {},
diagnosticHandler: collector,
options: ['--analyze-only'],
showDiagnostics: false);
return compiler.run(uri).then((_) {
for (DiagnosticMessage message in collector.warnings) {
Expect.equals(uri, message.uri);
int lineNo = file.getLine(message.begin);
if (expectedWarnings.containsKey(lineNo)) {
unseenWarnings.remove(lineNo);
} else {
warningsMismatch = true;
print(file.getLocationMessage(
'Unexpected warning: ${message.message}',
message.begin, message.end, true, (x) => x));
}
}
if (!unseenWarnings.isEmpty) {
warningsMismatch = true;
for (int lineNo in unseenWarnings) {
String line = expectedWarnings[lineNo];
print('$uri [${lineNo+1}]: Missing static type warning.');
print(line);
}
}
});
}).then((_) {
Expect.isFalse(warningsMismatch);
});
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Test that dart2js produces the expected static type warnings for type
// promotion langauge tests. This ensures that the analyzer and dart2js agrees
// on these tests.
import 'dart:async';
import 'dart:io';
import 'package:expect/expect.dart';
import 'memory_compiler.dart';
import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart';
import 'dart:convert';
const List<String> TESTS = const [
'language/type_promotion_assign_test.dart',
'language/type_promotion_closure_test.dart',
'language/type_promotion_functions_test.dart',
'language/type_promotion_local_test.dart',
'language/type_promotion_logical_and_test.dart',
'language/type_promotion_more_specific_test.dart',
'language/type_promotion_multiple_test.dart',
'language/type_promotion_parameter_test.dart',
];
void main() {
bool isWindows = Platform.isWindows;
Uri script = currentDirectory.resolveUri(Platform.script);
bool warningsMismatch = false;
Future.forEach(TESTS, (String test) {
Uri uri = script.resolve('../../$test');
String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
SourceFile file = new StringSourceFile(
relativize(currentDirectory, uri, isWindows), source);
Map<int,String> expectedWarnings = {};
int lineNo = 0;
for (String line in source.split('\n')) {
if (line.contains('///') && line.contains('static type warning')) {
expectedWarnings[lineNo] = line;
}
lineNo++;
}
Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys);
DiagnosticCollector collector = new DiagnosticCollector();
var compiler = compilerFor(const {},
diagnosticHandler: collector,
options: ['--analyze-only'],
showDiagnostics: false);
return compiler.run(uri).then((_) {
for (DiagnosticMessage message in collector.warnings) {
Expect.equals(uri, message.uri);
int lineNo = file.getLine(message.begin);
if (expectedWarnings.containsKey(lineNo)) {
unseenWarnings.remove(lineNo);
} else {
warningsMismatch = true;
print(file.getLocationMessage(
'Unexpected warning: ${message.message}',
message.begin, message.end, true, (x) => x));
}
}
if (!unseenWarnings.isEmpty) {
warningsMismatch = true;
for (int lineNo in unseenWarnings) {
String line = expectedWarnings[lineNo];
print('$uri [${lineNo+1}]: Missing static type warning.');
print(line);
}
}
});
}).then((_) {
Expect.isFalse(warningsMismatch);
});
}

View file

@ -17,7 +17,7 @@ import '../../../sdk/lib/_internal/compiler/compiler.dart'
import 'dart:async';
main() {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');

View file

@ -23,10 +23,7 @@ testLibraryUri(var value, Uri expectedUri) {
main() {
var mirrors = currentMirrorSystem();
test("Test current library uri", () {
String appendSlash(String path) => path.endsWith('/') ? path : '$path/';
Uri cwd =
new Uri.file(appendSlash(new File('.').resolveSymbolicLinksSync()));
Uri uri = cwd.resolveUri(new Uri.file(Platform.script));
Uri uri = Uri.base.resolveUri(Platform.script);
testLibraryUri(new Class(), uri);
});
}

View file

@ -52,7 +52,7 @@ void checkSuccess() {
void main() {
// Compute paths for coverage tool and coverage target relative
// the the path of this script.
var scriptPath = dirname(Platform.script);
var scriptPath = dirname(Platform.script.toFilePath());
var toolPath = normalize(join(scriptPath, coverageToolScript));
targPath = normalize(join(scriptPath, coverageTargetScript));

View file

@ -609,7 +609,7 @@ bool RunScript(List script, List<String> arguments) {
// Port number 0 means debug target picks a free port dynamically.
var targetOpts = [ "--debug:0" ];
targetOpts.add(Platform.script);
targetOpts.add(Platform.script.toFilePath());
targetOpts.add("--debuggee");
print('args: ${targetOpts.join(" ")}');

View file

@ -19,8 +19,7 @@ import 'dart:io';
import 'package:expect/expect.dart';
String pathToExecutable = Platform.executable;
String pathOfData = new File(Platform.script).parent.path +
'/http_launch_data';
Uri pathOfData = Platform.script.resolve('http_launch_data/');
int port;
_sendNotFound(HttpResponse response) {
@ -29,9 +28,9 @@ _sendNotFound(HttpResponse response) {
}
handleRequest(HttpRequest request) {
final String path = request.uri.path;
final String requestPath = '$pathOfData$path';
final File file = new File(requestPath);
final String path = request.uri.path.substring(1);
final Uri requestPath = pathOfData.resolve(path);
final File file = new File(requestPath.toFilePath());
file.exists().then((bool found) {
if (found) {
file.openRead()
@ -47,7 +46,8 @@ serverRunning(HttpServer server) {
port = server.port;
server.listen(handleRequest);
Future<ProcessResult> no_http_run =
Process.run(pathToExecutable, ['${pathOfData}/http_launch_main.dart']);
Process.run(pathToExecutable,
[pathOfData.resolve('http_launch_main.dart').toFilePath()]);
Future<ProcessResult> http_run =
Process.run(pathToExecutable,
['http://127.0.0.1:$port/http_launch_main.dart']);

View file

@ -51,7 +51,7 @@ main(List<String> arguments) {
"--log-code-drop",
"--optimization-counter-threshold=-1",
"--package-root=${Platform.packageRoot}",
Platform.script,
Platform.script.toFilePath(),
"--run"]);
// Code drops are logged with --log-code-drop. Look through stdout for the

View file

@ -7,7 +7,7 @@ import 'package:path/path.dart';
import 'dart:io';
void openAndWriteScript(String script) {
script = join(dirname(Platform.script), script);
script = Platform.script.resolve(script).toFilePath();
var executable = Platform.executable;
var file = script; // Use script as file.
Process.start("bash", ["-c", "$executable $script < $file"]).then((process) {

View file

@ -5,7 +5,7 @@
import 'dart:io';
void main() {
var expected = new File(Platform.script).readAsStringSync();
var expected = new File(Platform.script.toFilePath()).readAsStringSync();
var stdin = new File('/dev/fd/0').readAsStringSync();
if (expected != stdin) {
throw "stdin not equal expected file";

View file

@ -36,7 +36,7 @@ Future makeServer() {
Future runClientProcess(int port) {
return Process.run(Platform.executable,
[]..addAll(Platform.executableArguments)
..add(Platform.script)
..add(Platform.script.toFilePath())
..add('--client')
..add(port.toString())).then((ProcessResult result) {
if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {

View file

@ -746,7 +746,7 @@ void testRealProxyAuth() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -1,37 +1,36 @@
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
import 'dart:async';
import 'dart:io';
const CLIENT_SCRIPT = "http_server_close_response_after_error_client.dart";
void main() {
HttpServer.bind("127.0.0.1", 0)
.then((server) {
server.listen(
(request) {
request.listen(
null,
onError: (e) {},
onDone: () {
request.response.close();
});
});
var path = new Uri.file(Platform.script);
Process.run(Platform.executable,
[path.resolve(CLIENT_SCRIPT).toString(),
server.port.toString()])
.then((result) {
if (result.exitCode != 0) throw "Bad exit code";
server.close();
});
});
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
import 'dart:async';
import 'dart:io';
const CLIENT_SCRIPT = "http_server_close_response_after_error_client.dart";
void main() {
HttpServer.bind("127.0.0.1", 0)
.then((server) {
server.listen(
(request) {
request.listen(
null,
onError: (e) {},
onDone: () {
request.response.close();
});
});
Process.run(Platform.executable,
[Platform.script.resolve(CLIENT_SCRIPT).toString(),
server.port.toString()])
.then((result) {
if (result.exitCode != 0) throw "Bad exit code";
server.close();
});
});
}

View file

@ -16,7 +16,7 @@ main() {
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen(
(request) {
String name = Platform.script;
String name = Platform.script.toFilePath();
new File(name).openRead().pipe(request.response)
.catchError((e) { /* ignore */ });
});

View file

@ -118,7 +118,7 @@ testEarlyClose2() {
HttpServer.bind("127.0.0.1", 0).then((server) {
server.listen(
(request) {
String name = Platform.script;
String name = Platform.script.toFilePath();
new File(name).openRead().pipe(request.response)
.catchError((e) { /* ignore */ });
});

View file

@ -63,7 +63,7 @@ void testResponseDone() {
});
testServerRequest((server, request) {
new File("__not_exitsing_file_").openRead().pipe(request.response)
new File("__nonexistent_file_").openRead().pipe(request.response)
.catchError((e) {
server.close();
});
@ -80,10 +80,11 @@ void testResponseDone() {
void testResponseAddStream() {
int bytes = new File(Platform.script).lengthSync();
File file = new File(Platform.script.toFilePath());
int bytes = file.lengthSync();
testServerRequest((server, request) {
request.response.addStream(new File(Platform.script).openRead())
request.response.addStream(file.openRead())
.then((response) {
response.close();
response.done.then((_) => server.close());
@ -91,9 +92,9 @@ void testResponseAddStream() {
}, bytes: bytes);
testServerRequest((server, request) {
request.response.addStream(new File(Platform.script).openRead())
request.response.addStream(file.openRead())
.then((response) {
request.response.addStream(new File(Platform.script).openRead())
request.response.addStream(file.openRead())
.then((response) {
response.close();
response.done.then((_) => server.close());
@ -112,14 +113,14 @@ void testResponseAddStream() {
}, bytes: 0);
testServerRequest((server, request) {
request.response.addStream(new File("__not_exitsing_file_").openRead())
request.response.addStream(new File("__nonexistent_file_").openRead())
.catchError((e) {
server.close();
});
});
testServerRequest((server, request) {
new File("__not_exitsing_file_").openRead().pipe(request.response)
new File("__nonexistent_file_").openRead().pipe(request.response)
.catchError((e) {
server.close();
});
@ -128,8 +129,9 @@ void testResponseAddStream() {
void testResponseAddStreamClosed() {
File file = new File(Platform.script.toFilePath());
testServerRequest((server, request) {
request.response.addStream(new File(Platform.script).openRead())
request.response.addStream(file.openRead())
.then((response) {
response.close();
response.done.then((_) => server.close());
@ -139,7 +141,7 @@ void testResponseAddStreamClosed() {
testServerRequest((server, request) {
int count = 0;
write() {
request.response.addStream(new File(Platform.script).openRead())
request.response.addStream(file.openRead())
.then((response) {
request.response.write("sync data");
count++;
@ -157,15 +159,16 @@ void testResponseAddStreamClosed() {
void testResponseAddClosed() {
File file = new File(Platform.script.toFilePath());
testServerRequest((server, request) {
request.response.add(new File(Platform.script).readAsBytesSync());
request.response.add(file.readAsBytesSync());
request.response.close();
request.response.done.then((_) => server.close());
}, closeClient: true);
testServerRequest((server, request) {
for (int i = 0; i < 1000; i++) {
request.response.add(new File(Platform.script).readAsBytesSync());
request.response.add(file.readAsBytesSync());
}
request.response.close();
request.response.done.then((_) => server.close());
@ -174,7 +177,7 @@ void testResponseAddClosed() {
testServerRequest((server, request) {
int count = 0;
write() {
request.response.add(new File(Platform.script).readAsBytesSync());
request.response.add(file.readAsBytesSync());
Timer.run(() {
count++;
if (count < 1000) {

View file

@ -14,7 +14,7 @@ const CERTIFICATE = "localhost_cert";
Future<SecureServerSocket> runServer() {
SecureSocket.initialize(
database: join(dirname(Platform.script), 'pkcert'),
database: Platform.script.resolve('pkcert').toFilePath(),
password: 'dartdart');
return HttpServer.bindSecure(
@ -28,9 +28,9 @@ Future<SecureServerSocket> runServer() {
}
void main() {
var clientScript =
join(dirname(Platform.script), 'https_bad_certificate_client.dart');
var clientScript = Platform.script
.resolve('https_bad_certificate_client.dart')
.toFilePath();
Future clientProcess(int port, String acceptCertificate) {
return Process.run(Platform.executable,
[clientScript, port.toString(), acceptCertificate])

View file

@ -46,7 +46,7 @@ Function test() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -59,7 +59,7 @@ void testListenOn() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -15,7 +15,7 @@ const CERTIFICATE = "localhost_cert";
Future<SecureServerSocket> runServer() {
SecureSocket.initialize(
database: join(dirname(Platform.script), 'pkcert'),
database: Platform.script.resolve('pkcert').toFilePath(),
password: 'dartdart');
return HttpServer.bindSecure(
@ -29,9 +29,9 @@ Future<SecureServerSocket> runServer() {
}
void main() {
var clientScript = join(dirname(Platform.script),
'https_unauthorized_client.dart');
var clientScript = Platform.script
.resolve('https_unauthorized_client.dart')
.toFilePath();
Future clientProcess(int port) {
return Process.run(Platform.executable,
[clientScript, port.toString()])

View file

@ -25,7 +25,7 @@ test() {
var environment = Platform.environment;
Expect.isTrue(environment is Map<String, String>);
Expect.isTrue(Platform.executable.contains('dart'));
Expect.isTrue(Platform.script.replaceAll('\\', '/').
Expect.isTrue(Platform.script.path.
endsWith('tests/standalone/io/platform_test.dart'));
Directory packageRoot = new Directory(Platform.packageRoot);
Expect.isTrue(packageRoot.existsSync());
@ -48,7 +48,7 @@ testIsolate() {
port.first.then((results) {
Expect.equals(Platform.executable, results["Platform.executable"]);
Uri uri = new Uri.file(results["Platform.script"]);
Uri uri = results["Platform.script"];
// SpawnFunction retains the script url of the parent which in this
// case was a relative path.
Expect.equals("file", uri.scheme);

View file

@ -10,8 +10,7 @@ import "package:async_helper/async_helper.dart";
void main() {
asyncStart();
Process.run(Platform.executable,
[new Uri.file(Platform.script)
.resolve('print_sync_script.dart').toString()])
[Platform.script.resolve('print_sync_script.dart').toFilePath()])
.then((out) {
asyncEnd();
Expect.equals(1002, out.stdout.split('\n').length);

View file

@ -22,7 +22,7 @@ class Expect {
}
main(List<String> arguments) {
Expect.isTrue(Platform.script.endsWith(
Expect.isTrue(Platform.script.path.endsWith(
'process_check_arguments_script.dart'));
var expected_num_args = int.parse(arguments[0]);
var contains_quote = int.parse(arguments[1]);

View file

@ -12,8 +12,9 @@ import "dart:io";
main() {
var executable = Platform.executable;
var exitCodeScript = join(dirname(Platform.script),
'process_set_exit_code_script.dart');
var exitCodeScript = Platform.script
.resolve('process_set_exit_code_script.dart')
.toFilePath();
Process.run(executable, [exitCodeScript]).then((result) {
Expect.equals("standard out", result.stdout);
Expect.equals("standard error", result.stderr);

View file

@ -11,7 +11,7 @@ import "dart:isolate";
void testRunShell() {
test(args) {
asyncStart();
var path = join(dirname(Platform.script), "process_echo_util.dart");
var path = Platform.script.resolve("process_echo_util.dart").toFilePath();
Process.run(Platform.executable,
[path]..addAll(args),
runInShell: true)

View file

@ -12,8 +12,9 @@ test(int blockCount,
int exitCode,
[int nonWindowsExitCode]) {
// Get the Dart script file that generates output.
var scriptFile = new File(join(dirname(Platform.script),
"process_sync_script.dart"));
var scriptFile = new File(Platform.script
.resolve("process_sync_script.dart")
.toFilePath());
var args = [scriptFile.path,
blockCount.toString(),
stdoutBlockSize.toString(),

View file

@ -145,7 +145,7 @@ testCloseServer() {
main() {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -55,7 +55,7 @@ void testArguments() {
main() {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -473,7 +473,7 @@ void testSimpleReadWrite({bool listenSecure,
}
main() {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -35,7 +35,7 @@ Future<HttpServer> startServer() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -35,7 +35,7 @@ Future<HttpServer> startServer() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -49,7 +49,7 @@ Future makeServer() {
Future runClientProcess(int port) {
return Process.run(Platform.executable,
[]..addAll(Platform.executableArguments)
..add(Platform.script)
..add(Platform.script.toFilePath())
..add('--client')
..add(port.toString())).then((ProcessResult result) {
if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {

View file

@ -11,7 +11,8 @@ main() {
// Start sub-process when receiving data.
var subscription;
subscription = stdin.listen((data) {
Process.start(Platform.executable, [Platform.script]).then((p) {
Process.start(Platform.executable,
[Platform.script.toFilePath()]).then((p) {
p.stdout.listen((_) { });
p.stderr.listen((_) { });
// When receiving data again, kill sub-process and exit.

View file

@ -18,7 +18,7 @@ import 'package:path/path.dart';
main() {
asyncStart();
var executable = Platform.executable;
var script = join(dirname(Platform.script), 'regress_7191_script.dart');
var script = Platform.script.resolve('regress_7191_script.dart').toFilePath();
Process.start(executable, [script]).then((process) {
process.stdin.add([0]);
process.stdout.listen((_) { },

View file

@ -11,7 +11,7 @@ import 'dart:async';
import 'dart:io';
main() {
String testsDir = dirname(dirname(dirname(Platform.script)));
String testsDir = Platform.script.resolve('../..').toFilePath();
// All of these tests test that resolveSymbolicLinks gives a path
// that points to the same place as the original, and that it removes
// all links, .., and . segments, and that it produces an absolute path.

View file

@ -13,8 +13,7 @@ const HOST_NAME = "localhost";
const CERTIFICATE = "localhost_cert";
String certificateDatabase() =>
join(dirname(Platform.script), 'pkcert');
String certificateDatabase() => Platform.script.resolve('pkcert').toFilePath();
Future<SecureServerSocket> runServer() {
SecureSocket.initialize(database: certificateDatabase(),
@ -34,8 +33,9 @@ Future<SecureServerSocket> runServer() {
void main() {
var clientScript = join(dirname(Platform.script),
'secure_bad_certificate_client.dart');
var clientScript = Platform.script
.resolve('secure_bad_certificate_client.dart')
.toFilePath();
Future clientProcess(int port, String acceptCertificate) {
return Process.run(Platform.executable,

View file

@ -24,7 +24,7 @@ void InitializeSSL({bool useDatabase, bool useBuiltinRoots}) {
// should signal an error. Even when an external database is loaded,
// they should not be loaded.
if (useDatabase) {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: useBuiltinRoots);
@ -66,7 +66,7 @@ void runAllTestsInChildProcesses() {
Future runChild(List<String> scriptArguments) {
return Process.run(Platform.executable,
[]..addAll(Platform.executableArguments)
..add(Platform.script)
..add(Platform.script.toFilePath())
..addAll(scriptArguments))
.then((ProcessResult result) {
if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {

View file

@ -78,7 +78,7 @@ Future testClient(server) {
}
void main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');

View file

@ -43,7 +43,7 @@ Future testClient(server) {
}
void main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');

View file

@ -46,7 +46,7 @@ Future testClient(server, name) {
}
void main() {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');

View file

@ -71,7 +71,7 @@ Future testRequiredClientCertificate() {
}
void main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -58,7 +58,7 @@ Future testNoRequiredClientCertificate() {
}
void main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -153,7 +153,7 @@ testCloseServer() {
main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -190,7 +190,7 @@ void testSimpleReadWrite() {
main() {
asyncStart();
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -55,7 +55,7 @@ Future testClient(server, name) {
}
void main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart');

View file

@ -161,7 +161,7 @@ Future test(bool hostnameInConnect) {
main() {
String certificateDatabase = join(dirname(Platform.script), 'pkcert');
String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -17,7 +17,7 @@ const HOST_NAME = "localhost";
const CERTIFICATE = "localhost_cert";
String certificateDatabase() => join(dirname(Platform.script), 'pkcert');
String certificateDatabase() => Platform.script.resolve('pkcert').toFilePath();
Future<SecureServerSocket> runServer() {
@ -65,8 +65,9 @@ Future<SecureServerSocket> runServer() {
void main() {
runServer()
.then((SecureServerSocket server) {
var clientScript =
Platform.script.replaceFirst("_test.dart", "_client.dart");
var clientScript = Platform.script
.toFilePath()
.replaceFirst("_test.dart", "_client.dart");
Expect.isTrue(clientScript.endsWith("_client.dart"));
Process.run(Platform.executable,
[clientScript,

View file

@ -34,7 +34,7 @@ Future<HttpServer> startServer() {
}
void InitializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
}

View file

@ -15,7 +15,7 @@ const CERTIFICATE = "localhost_cert";
Future<SecureServerSocket> runServer() {
SecureSocket.initialize(
database: join(dirname(Platform.script), 'pkcert'),
database: Platform.script.resolve('pkcert').toFilePath(),
password: 'dartdart');
return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
@ -31,8 +31,9 @@ Future<SecureServerSocket> runServer() {
}
void main() {
var clientScript = join(dirname(Platform.script),
'secure_unauthorized_client.dart');
var clientScript = Platform.script
.resolve('secure_unauthorized_client.dart')
.toFilePath();
Future clientProcess(int port) {
return Process.run(Platform.executable,

View file

@ -148,8 +148,8 @@ class CommandCompletedHandler {
runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) {
var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0];
var createFileScript = join(dirname(Platform.script),
'skipping_dart2js_compilations_helper.dart');
var createFileScript = Platform.script
.resolve('skipping_dart2js_compilations_helper.dart').toFilePath();
var executable = Platform.executable;
var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()];
var bootstrapDeps = [

View file

@ -36,7 +36,7 @@ Future makeServer() {
Future runClientProcess(int port) {
return Process.run(Platform.executable,
[]..addAll(Platform.executableArguments)
..add(Platform.script)
..add(Platform.script.toFilePath())
..add('--client')
..add(port.toString())).then((ProcessResult result) {
if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {

View file

@ -213,7 +213,7 @@ void test(bool hostnameInConnect,
}
main() {
var certificateDatabase = join(dirname(Platform.script), 'pkcert');
var certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: certificateDatabase,
password: 'dartdart',
useBuiltinRoots: false);

View file

@ -9,7 +9,7 @@ import "package:path/path.dart";
void testReadByte() {
void test(String line, List<String> expected) {
var script = join(dirname(Platform.script), "stdin_sync_script.dart");
var script = Platform.script.resolve("stdin_sync_script.dart").toFilePath();
Process.start(Platform.executable,
["--checked", script]..addAll(
expected.map(JSON.encode))).then((process) {

View file

@ -36,7 +36,7 @@ String getExtensionPath(String buildDirectory) {
}
void main() {
String scriptDirectory = dirname(Platform.script);
String scriptDirectory = dirname(Platform.script.toFilePath());
String buildDirectory = dirname(Platform.executable);
Directory tempDirectory =
Directory.systemTemp.createTempSync('dart_test_extension_fail');

View file

@ -36,7 +36,7 @@ String getExtensionPath(String buildDirectory) {
}
void main() {
String scriptDirectory = dirname(Platform.script);
String scriptDirectory = dirname(Platform.script.toFilePath());
String buildDirectory = dirname(Platform.executable);
Directory tempDirectory =
Directory.systemTemp.createTempSync('dart_test_extension');

View file

@ -83,7 +83,7 @@ class CustomTestSuite extends TestSuite {
TestCase _makeNormalTestCase(name, expectations) {
var command = CommandBuilder.instance.getCommand(
'custom', Platform.executable, [Platform.script, name],
'custom', Platform.executable, [Platform.script.toFilePath(), name],
'ReleaseIA32');
return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations);
}

View file

@ -90,7 +90,7 @@ class SecurityConfiguration {
void initializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: "dartdart");
}

View file

@ -408,7 +408,7 @@ class SecurityConfiguration {
void initializeSSL() {
var testPkcertDatabase = join(dirname(Platform.script), 'pkcert');
var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: "dartdart");
}

View file

@ -18,8 +18,9 @@ set SCRIPTDIR=%~dp0
%1 %2
""");
var dart = Platform.executable;
var script = join(dirname(Platform.script),
'windows_environment_script.dart');
var script = Platform.script
.resolve('windows_environment_script.dart')
.toFilePath();
Process.run('cmd',
['/c', funkyFile.path, dart, script]).then((p) {
if (0 != p.exitCode) throw "Exit code not 0";

View file

@ -22,7 +22,7 @@ second(message) {
main() {
asyncStart();
new File(Platform.script).readAsBytes().then((List<int> data) {
new File(Platform.script.toFilePath()).readAsBytes().then((List<int> data) {
var response = new ReceivePort();
var remote = Isolate.spawn(second, [data, response.sendPort]);
response.first.then((reply) {

View file

@ -80,7 +80,7 @@ class TestLauncher {
TestLauncher(this.script);
String get scriptPath {
var dartScript = Platform.script;
var dartScript = Platform.script.toFilePath();
var splitPoint = dartScript.lastIndexOf(Platform.pathSeparator);
var scriptDirectory = dartScript.substring(0, splitPoint);
return scriptDirectory + Platform.pathSeparator + script;

View file

@ -14,24 +14,15 @@ import 'package:path/path.dart' as path;
import '../lib/docs.dart';
final String json_path =
path.normalize(path.join(scriptDir, '..', 'docs.json'));
final String lib_path =
path.toUri(path.normalize(
path.join(scriptDir, '..', '..', '..', '..', 'sdk'))).toString();
final String json_path = Platform.script.resolve('../docs.json').toFilePath();
final String lib_uri = Platform.script.resolve('../../../../sdk').toString();
main() {
print('Converting HTML docs from $lib_path to $json_path.');
print('Converting HTML docs from $lib_uri to $json_path.');
convert(lib_path, json_path)
convert(lib_uri, json_path)
.then((bool anyErrors) {
print('Converted HTML docs ${anyErrors ? "with": "without"}'
' errors.');
});
}
/**
* Gets the full path to the directory containing the entrypoint of the current
* script.
*/
String get scriptDir => path.dirname(Platform.script);

View file

@ -83,8 +83,7 @@ void main(List<String> arguments) {
if (!args.containsKey("output_dir")) throw "Please specify output_dir";
if (!args.containsKey("package_root")) throw "Please specify package_root";
var scriptFile =
new Uri.file(new File(Platform.script).resolveSymbolicLinksSync());
var scriptFile = Uri.base.resolveUri(Platform.script);
var path = scriptFile.resolve(".");
var rootPath = path.resolve("../..");
getSnapshotGenerationFile(args, rootPath).then((result) {