Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: dart/lib/compiler/implementation/filenames.dart

Issue 10207010: Make dart2js work on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: dart/lib/compiler/implementation/filenames.dart
diff --git a/dart/lib/compiler/implementation/filenames.dart b/dart/lib/compiler/implementation/filenames.dart
index 0e43bca65da90f461e00f9a6bcc6d90e606daf53..82ff21c5b05309cc4b70873a494cdac466d6bdcc 100644
--- a/dart/lib/compiler/implementation/filenames.dart
+++ b/dart/lib/compiler/implementation/filenames.dart
@@ -5,6 +5,7 @@
#library('filenames');
#import('dart:io');
+#import('dart:uri');
// TODO(ahe): This library should be replaced by a general
// path-munging library.
@@ -14,6 +15,7 @@
String nativeToUriPath(String filename) {
if (Platform.operatingSystem() != 'windows') return filename;
+ filename = filename.toLowerCase();
filename = filename.replaceAll('\\', '/');
if (filename.length > 2 && filename[1] == ':') {
filename = "/$filename";
@@ -23,9 +25,17 @@ String nativeToUriPath(String filename) {
String uriPathToNative(String path) {
if (Platform.operatingSystem() != 'windows') return path;
+ path = path.toLowerCase();
if (path.length > 3 && path[0] == '/' && path[2] == ':') {
return path.substring(1);
} else {
return path;
}
}
+
+Uri getCurrentDirectory() {
+ final String dir = nativeToUriPath(new File('.').fullPathSync());
+ return new Uri(scheme: 'file', path: appendSlash(dir));
+}
+
+String appendSlash(String path) => path.endsWith('/') ? path : '$path/';
« no previous file with comments | « dart/lib/compiler/implementation/dart2js.dart ('k') | dart/lib/compiler/implementation/util/uri_extras.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698