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

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

Issue 23468027: Add FileSystemEntity.absolutePath and .isAbsolute properties. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change name to absolute, return type to File, Directory, and Link. Created 7 years, 3 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/directory.dart ('k') | sdk/lib/io/file.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 _Directory extends FileSystemEntity implements Directory { 7 class _Directory extends FileSystemEntity implements Directory {
8 static const CREATE_REQUEST = 0; 8 static const CREATE_REQUEST = 0;
9 static const DELETE_REQUEST = 1; 9 static const DELETE_REQUEST = 1;
10 static const EXISTS_REQUEST = 2; 10 static const EXISTS_REQUEST = 2;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 bool existsSync() { 69 bool existsSync() {
70 var result = _exists(path); 70 var result = _exists(path);
71 if (result is OSError) { 71 if (result is OSError) {
72 throw new DirectoryException("Exists failed", path, result); 72 throw new DirectoryException("Exists failed", path, result);
73 } 73 }
74 return (result == 1); 74 return (result == 1);
75 } 75 }
76 76
77 Directory get absolute => new Directory(_absolutePath);
78
77 Future<FileStat> stat() => FileStat.stat(path); 79 Future<FileStat> stat() => FileStat.stat(path);
78 80
79 FileStat statSync() => FileStat.statSync(path); 81 FileStat statSync() => FileStat.statSync(path);
80 82
81 // Compute the index of the first directory in the list that exists. If 83 // Compute the index of the first directory in the list that exists. If
82 // none of the directories exist dirsToCreate.length is returned. 84 // none of the directories exist dirsToCreate.length is returned.
83 Future<int> _computeExistingIndex(List dirsToCreate) { 85 Future<int> _computeExistingIndex(List dirsToCreate) {
84 var future; 86 var future;
85 var notFound = dirsToCreate.length; 87 var notFound = dirsToCreate.length;
86 for (var i = 0; i < dirsToCreate.length; i++) { 88 for (var i = 0; i < dirsToCreate.length; i++) {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 controller.addError( 408 controller.addError(
407 new DirectoryException("Directory listing failed", 409 new DirectoryException("Directory listing failed",
408 errorPath, 410 errorPath,
409 err)); 411 err));
410 } else { 412 } else {
411 controller.addError( 413 controller.addError(
412 new DirectoryException("Internal error")); 414 new DirectoryException("Internal error"));
413 } 415 }
414 } 416 }
415 } 417 }
OLDNEW
« no previous file with comments | « sdk/lib/io/directory.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698