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

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

Issue 11364097: Allow Directory.create to create all missing path components. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload Created 8 years, 1 month 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/directory_impl.dart ('k') | tests/standalone/io/dart_std_io_pipe_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 class _Path implements Path { 5 class _Path implements Path {
6 final String _path; 6 final String _path;
7 7
8 _Path(String source) : _path = source; 8 _Path(String source) : _path = source;
9 _Path.fromNative(String source) : _path = _clean(source); 9 _Path.fromNative(String source) : _path = _clean(source);
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 segmentsToJoin.add(''); 182 segmentsToJoin.add('');
183 } 183 }
184 } 184 }
185 return new Path(Strings.join(segmentsToJoin, '/')); 185 return new Path(Strings.join(segmentsToJoin, '/'));
186 } 186 }
187 187
188 String toNativePath() { 188 String toNativePath() {
189 if (Platform.operatingSystem == 'windows') { 189 if (Platform.operatingSystem == 'windows') {
190 String nativePath = _path; 190 String nativePath = _path;
191 // Drop '/' before a drive letter. 191 // Drop '/' before a drive letter.
192 if (nativePath.length > 3 && 192 if (nativePath.length >= 3 &&
193 nativePath.startsWith('/') && 193 nativePath.startsWith('/') &&
Søren Gjesse 2012/11/06 10:45:26 Now that you are at it maybe check that nativePath
Mads Ager (google) 2012/11/06 15:00:35 Not sure we have to. If you use this and it doesn'
194 nativePath[2] == ':') { 194 nativePath[2] == ':') {
195 nativePath = nativePath.substring(1); 195 nativePath = nativePath.substring(1);
196 } 196 }
197 nativePath = nativePath.replaceAll('/', '\\'); 197 nativePath = nativePath.replaceAll('/', '\\');
198 return nativePath; 198 return nativePath;
199 } 199 }
200 return _path; 200 return _path;
201 } 201 }
202 202
203 List<String> segments() { 203 List<String> segments() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (pos < 0) return new Path(''); 235 if (pos < 0) return new Path('');
236 while (pos > 0 && _path[pos - 1] == '/') --pos; 236 while (pos > 0 && _path[pos - 1] == '/') --pos;
237 return new Path((pos > 0) ? _path.substring(0, pos) : '/'); 237 return new Path((pos > 0) ? _path.substring(0, pos) : '/');
238 } 238 }
239 239
240 String get filename { 240 String get filename {
241 int pos = _path.lastIndexOf('/'); 241 int pos = _path.lastIndexOf('/');
242 return _path.substring(pos + 1); 242 return _path.substring(pos + 1);
243 } 243 }
244 } 244 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | tests/standalone/io/dart_std_io_pipe_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698