mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 20:01:19 +00:00
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:
parent
d5edc5c73e
commit
cb0110350a
|
@ -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 (_) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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((_) {
|
||||
|
|
|
@ -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';
|
||||
|
|
2
pkg/third_party/html5lib/test/support.dart
vendored
2
pkg/third_party/html5lib/test/support.dart
vendored
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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('../');
|
||||
|
||||
|
|
|
@ -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 =>
|
||||
|
|
|
@ -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.');
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -28,8 +28,8 @@ const List<String> TESTS = const [
|
|||
];
|
||||
|
||||
void main() {
|
||||
bool isWindows = (Platform.operatingSystem == 'windows');
|
||||
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
|
||||
bool isWindows = Platform.isWindows;
|
||||
Uri script = currentDirectory.resolveUri(Platform.script);
|
||||
bool warningsMismatch = false;
|
||||
Future.forEach(TESTS, (String test) {
|
||||
Uri uri = script.resolve('../../$test');
|
||||
|
|
|
@ -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/');
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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(" ")}');
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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')) {
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -24,9 +24,8 @@ void main() {
|
|||
request.response.close();
|
||||
});
|
||||
});
|
||||
var path = new Uri.file(Platform.script);
|
||||
Process.run(Platform.executable,
|
||||
[path.resolve(CLIENT_SCRIPT).toString(),
|
||||
[Platform.script.resolve(CLIENT_SCRIPT).toString(),
|
||||
server.port.toString()])
|
||||
.then((result) {
|
||||
if (result.exitCode != 0) throw "Bad exit code";
|
||||
|
|
|
@ -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 */ });
|
||||
});
|
||||
|
|
|
@ -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 */ });
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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()])
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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')) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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((_) { },
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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')) {
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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')) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue