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

Side by Side Diff: sdk/lib/io/path_impl.dart

Issue 11878015: Default constructor for dart:io Path now handles native Windows paths. Path() now does the same as… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't change tools/version.dart until the binaries are updated. Created 7 years, 11 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 | « sdk/lib/io/path.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | 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 part of dart.io; 5 part of dart.io;
6 6
7 class _Path implements Path { 7 class _Path implements Path {
8 final String _path; 8 final String _path;
9 final bool isWindowsShare; 9 final bool isWindowsShare;
10 10
11 _Path(String source) : _path = source, isWindowsShare = false; 11 _Path(String source)
12 : _path = _clean(source), isWindowsShare = _isWindowsShare(source);
12 13
13 _Path.fromNative(String source) 14 _Path.raw(String source) : _path = source, isWindowsShare = false;
14 : _path = _clean(source), isWindowsShare = _isWindowsShare(source);
15 15
16 _Path._internal(String this._path, bool this.isWindowsShare); 16 _Path._internal(String this._path, bool this.isWindowsShare);
17 17
18 static String _clean(String source) { 18 static String _clean(String source) {
19 if (Platform.operatingSystem == 'windows') return _cleanWindows(source); 19 if (Platform.operatingSystem == 'windows') return _cleanWindows(source);
20 return source; 20 return source;
21 } 21 }
22 22
23 static String _cleanWindows(String source) { 23 static String _cleanWindows(String source) {
24 // Change \ to /. 24 // Change \ to /.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 while (pos > 0 && _path[pos - 1] == '/') --pos; 253 while (pos > 0 && _path[pos - 1] == '/') --pos;
254 var dirPath = (pos > 0) ? _path.substring(0, pos) : '/'; 254 var dirPath = (pos > 0) ? _path.substring(0, pos) : '/';
255 return new _Path._internal(dirPath, isWindowsShare); 255 return new _Path._internal(dirPath, isWindowsShare);
256 } 256 }
257 257
258 String get filename { 258 String get filename {
259 int pos = _path.lastIndexOf('/'); 259 int pos = _path.lastIndexOf('/');
260 return _path.substring(pos + 1); 260 return _path.substring(pos + 1);
261 } 261 }
262 } 262 }
OLDNEW
« no previous file with comments | « sdk/lib/io/path.dart ('k') | tests/compiler/dart2js/mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698