| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #library('filenames'); |
| 6 |
| 7 #import('dart:io'); |
| 8 |
| 9 // TODO(ahe): This library should be replaced by a general |
| 10 // path-munging library. |
| 11 // |
| 12 // See also: |
| 13 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx |
| 14 |
| 15 String nativeToUriPath(String filename) { |
| 16 if (Platform.operatingSystem() != 'windows') return filename; |
| 17 filename = filename.replaceAll('\\', '/'); |
| 18 if (filename.length > 2 && filename[1] == ':') { |
| 19 filename = "/$filename"; |
| 20 } |
| 21 return filename; |
| 22 } |
| 23 |
| 24 String uriPathToNative(String path) { |
| 25 if (Platform.operatingSystem() != 'windows') return path; |
| 26 if (path.length > 3 && path[0] == '/' && path[2] == ':') { |
| 27 return path.substring(1); |
| 28 } else { |
| 29 return path; |
| 30 } |
| 31 } |
| OLD | NEW |