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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/filenames.dart

Issue 20020003: Fix bad rewrite of boolean expression (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library filenames; 5 library filenames;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 // For information about how to convert Windows file names to URIs: 9 // For information about how to convert Windows file names to URIs:
10 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx 10 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
11 11
12 String nativeToUriPath(String filename) { 12 String nativeToUriPath(String filename) {
13 // TODO(ahe): It would be nice to use a Dart library instead. 13 // TODO(ahe): It would be nice to use a Dart library instead.
14 if (Platform.isWindows) return filename; 14 if (!Platform.isWindows) return filename;
15 filename = filename.replaceAll('\\', '/'); 15 filename = filename.replaceAll('\\', '/');
16 if (filename.length > 2 && filename[1] == ':') { 16 if (filename.length > 2 && filename[1] == ':') {
17 filename = "/$filename"; 17 filename = "/$filename";
18 } 18 }
19 return filename; 19 return filename;
20 } 20 }
21 21
22 String uriPathToNative(String path) { 22 String uriPathToNative(String path) {
23 // TODO(ahe): It would be nice to use a Dart library instead. 23 // TODO(ahe): It would be nice to use a Dart library instead.
24 if (Platform.operatingSystem != 'windows') return path; 24 if (!Platform.isWindows) return filename;
25 if (path.length > 3 && path[0] == '/' && path[2] == ':') { 25 if (path.length > 3 && path[0] == '/' && path[2] == ':') {
26 return path.substring(1).replaceAll('/', '\\'); 26 return path.substring(1).replaceAll('/', '\\');
27 } else { 27 } else {
28 return path.replaceAll('/', '\\'); 28 return path.replaceAll('/', '\\');
29 } 29 }
30 } 30 }
31 31
32 final Uri currentDirectory = new Uri( 32 final Uri currentDirectory = new Uri(
33 scheme: 'file', 33 scheme: 'file',
34 path: appendSlash(nativeToUriPath(new File('.').fullPathSync()))); 34 path: appendSlash(nativeToUriPath(new File('.').fullPathSync())));
35 35
36 String appendSlash(String path) => path.endsWith('/') ? path : '$path/'; 36 String appendSlash(String path) => path.endsWith('/') ? path : '$path/';
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698