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

Unified Diff: sdk/lib/io/file_impl.dart

Issue 15832003: Change File.directory to not do any IO (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/file.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 29b93dc6ab2a11a94c4f6459e473985d8d12d558..2392b38862eae0cd9d156fa46cfafaa7ce7aa4fd 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -204,26 +204,25 @@ const int _CREATE_REQUEST = 1;
const int _DELETE_REQUEST = 2;
const int _OPEN_REQUEST = 3;
const int _FULL_PATH_REQUEST = 4;
-const int _DIRECTORY_REQUEST = 5;
-const int _CLOSE_REQUEST = 6;
-const int _POSITION_REQUEST = 7;
-const int _SET_POSITION_REQUEST = 8;
-const int _TRUNCATE_REQUEST = 9;
-const int _LENGTH_REQUEST = 10;
-const int _LENGTH_FROM_PATH_REQUEST = 11;
-const int _LAST_MODIFIED_REQUEST = 12;
-const int _FLUSH_REQUEST = 13;
-const int _READ_BYTE_REQUEST = 14;
-const int _WRITE_BYTE_REQUEST = 15;
-const int _READ_REQUEST = 16;
-const int _READ_LIST_REQUEST = 17;
-const int _WRITE_LIST_REQUEST = 18;
-const int _CREATE_LINK_REQUEST = 19;
-const int _DELETE_LINK_REQUEST = 20;
-const int _LINK_TARGET_REQUEST = 21;
-const int _TYPE_REQUEST = 22;
-const int _IDENTICAL_REQUEST = 23;
-const int _STAT_REQUEST = 24;
+const int _CLOSE_REQUEST = 5;
+const int _POSITION_REQUEST = 6;
+const int _SET_POSITION_REQUEST = 7;
+const int _TRUNCATE_REQUEST = 8;
+const int _LENGTH_REQUEST = 9;
+const int _LENGTH_FROM_PATH_REQUEST = 10;
+const int _LAST_MODIFIED_REQUEST = 11;
+const int _FLUSH_REQUEST = 12;
+const int _READ_BYTE_REQUEST = 13;
+const int _WRITE_BYTE_REQUEST = 14;
+const int _READ_REQUEST = 15;
+const int _READ_LIST_REQUEST = 16;
+const int _WRITE_LIST_REQUEST = 17;
+const int _CREATE_LINK_REQUEST = 18;
+const int _DELETE_LINK_REQUEST = 19;
+const int _LINK_TARGET_REQUEST = 20;
+const int _TYPE_REQUEST = 21;
+const int _IDENTICAL_REQUEST = 22;
+const int _STAT_REQUEST = 23;
// TODO(ager): The only reason for this class is that the patching
// mechanism doesn't seem to like patching a private top level
@@ -313,27 +312,9 @@ class _File implements File {
throwIfError(result, "Cannot delete file '$_path'");
}
- Future<Directory> directory() {
- _ensureFileService();
- List request = new List(2);
- request[0] = _DIRECTORY_REQUEST;
- request[1] = _path;
- return _fileService.call(request).then((response) {
- if (_isErrorResponse(response)) {
- throw _exceptionFromResponse(response,
- "Cannot retrieve directory for "
- "file '$_path'");
- }
- return new Directory(response);
- });
- }
-
- external static _directory(String path);
-
- Directory directorySync() {
- var result = _directory(path);
- throwIfError(result, "Cannot retrieve directory for file '$_path'");
- return new Directory(result);
+ Directory get directory {
+ Path path = new Path(_path).directoryPath;
+ return new Directory.fromPath(path);
}
Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) {
« no previous file with comments | « sdk/lib/io/file.dart ('k') | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698