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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/mime_multipart_parser.dart ('k') | sdk/lib/io/process.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
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 segs[0] = null; // Faster than removeRange(). 127 segs[0] = null; // Faster than removeRange().
128 } else { // A canonical relative path may start with .. segments. 128 } else { // A canonical relative path may start with .. segments.
129 for (int pos = 0; 129 for (int pos = 0;
130 pos < segs.length && segs[pos] == '..'; 130 pos < segs.length && segs[pos] == '..';
131 ++pos) { 131 ++pos) {
132 segs[pos] = null; 132 segs[pos] = null;
133 } 133 }
134 } 134 }
135 if (segs.last == '') segs.removeLast(); // Path ends with /. 135 if (segs.last == '') segs.removeLast(); // Path ends with /.
136 // No remaining segments can be ., .., or empty. 136 // No remaining segments can be ., .., or empty.
137 return !segs.some((s) => s == '' || s == '.' || s == '..'); 137 return !segs.any((s) => s == '' || s == '.' || s == '..');
138 } 138 }
139 139
140 Path makeCanonical() { 140 Path makeCanonical() {
141 bool isAbs = isAbsolute; 141 bool isAbs = isAbsolute;
142 List segs = segments(); 142 List segs = segments();
143 String drive; 143 String drive;
144 if (isAbs && 144 if (isAbs &&
145 !segs.isEmpty && 145 !segs.isEmpty &&
146 segs[0].length == 2 && 146 segs[0].length == 2 &&
147 segs[0][1] == ':') { 147 segs[0][1] == ':') {
(...skipping 105 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/mime_multipart_parser.dart ('k') | sdk/lib/io/process.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698