| Index: dart/lib/compiler/implementation/filenames.dart
|
| diff --git a/dart/lib/compiler/implementation/filenames.dart b/dart/lib/compiler/implementation/filenames.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0e43bca65da90f461e00f9a6bcc6d90e606daf53
|
| --- /dev/null
|
| +++ b/dart/lib/compiler/implementation/filenames.dart
|
| @@ -0,0 +1,31 @@
|
| +// Copyright (c) 2012, 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('filenames');
|
| +
|
| +#import('dart:io');
|
| +
|
| +// TODO(ahe): This library should be replaced by a general
|
| +// path-munging library.
|
| +//
|
| +// See also:
|
| +// http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
|
| +
|
| +String nativeToUriPath(String filename) {
|
| + if (Platform.operatingSystem() != 'windows') return filename;
|
| + filename = filename.replaceAll('\\', '/');
|
| + if (filename.length > 2 && filename[1] == ':') {
|
| + filename = "/$filename";
|
| + }
|
| + return filename;
|
| +}
|
| +
|
| +String uriPathToNative(String path) {
|
| + if (Platform.operatingSystem() != 'windows') return path;
|
| + if (path.length > 3 && path[0] == '/' && path[2] == ':') {
|
| + return path.substring(1);
|
| + } else {
|
| + return path;
|
| + }
|
| +}
|
|
|