Fix bad space handling in Uris.

BUG= http://dartbug.com/15972
R=ahe@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31748 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
floitsch@google.com
2014-01-13 17:28:56 +00:00
parent d5257a2ae3
commit 5a0eb56fb0
8 changed files with 50 additions and 4 deletions
@@ -376,7 +376,7 @@ Future compile(List<String> argv) {
}
RandomAccessFile output =
new File(uriPathToNative(uri.path)).openSync(mode: FileMode.WRITE);
new File(uri.toFilePath()).openSync(mode: FileMode.WRITE);
int charactersWritten = 0;
writeStringSync(String data) {
@@ -445,7 +445,7 @@ void writeString(Uri uri, String text) {
if (uri.scheme != 'file') {
fail('Error: Unhandled scheme ${uri.scheme}.');
}
var file = new File(uriPathToNative(uri.path)).openSync(mode: FileMode.WRITE);
var file = new File(uri.toFilePath()).openSync(mode: FileMode.WRITE);
file.writeStringSync(text);
file.closeSync();
}
@@ -971,6 +971,9 @@ class LibraryElementX extends ElementX implements LibraryElement {
* Returns the library name (as defined by the library tag) or for script
* (which have no library tag) the script file name. The latter case is used
* to private 'library name' for scripts to use for instance in dartdoc.
*
* Note: the returned filename will still be escaped ("a%20b.dart" instead of
* "a b.dart").
*/
String getLibraryOrScriptName() {
if (libraryTag != null) {
@@ -42,7 +42,7 @@ abstract class SourceFileProvider {
}
List<int> source;
try {
source = readAll(uriPathToNative(resourceUri.path));
source = readAll(resourceUri.toFilePath());
} on FileSystemException catch (ex) {
return new Future.error(
"Error reading '${relativize(cwd, resourceUri, isWindows)}' "
@@ -31,7 +31,7 @@ Future<String> provideInput(Uri uri) {
var source = SOURCES[uri.path];
if (source == null) {
// Not one of our source files, so assume it's a built-in.
source = new File(uriPathToNative(uri.path)).readAsStringSync();
source = new File(uri.toFilePath()).readAsStringSync();
}
// Deliver the input asynchronously.
@@ -0,0 +1,9 @@
// Copyright (c) 2014, 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.
import 'library space/lib with spaces.dart';
main() {
if (foo() != 499) throw "bad value";
}
@@ -0,0 +1,9 @@
// Copyright (c) 2014, 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.
library spaces;
part "part space/part space.dart";
foo() => bar();
@@ -0,0 +1,7 @@
// Copyright (c) 2014, 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.
part of spaces;
bar() => 499;
+18
View File
@@ -0,0 +1,18 @@
// Copyright (c) 2014, 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.
import 'dart:io';
import '../../../sdk/lib/_internal/compiler/implementation/dart2js.dart'
as dart2js;
main() {
Uri currentDirectory = Uri.base;
Uri script = currentDirectory.resolveUri(Platform.script);
Uri libraryRoot = script.resolve('../../../sdk/');
Directory.current = script.resolve("path with spaces").toFilePath();
return dart2js.main(["--library-root=${libraryRoot.toFilePath()}",
"--analyze-only",
"file with spaces.dart"]);
}