Index: runtime/bin/directory.h |
diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h |
index 0350fc0a86868abdab94041a09d1e8ca6d0fffd0..16c8443f383099a5c875e3e86ac1482d94a17261 100644 |
--- a/runtime/bin/directory.h |
+++ b/runtime/bin/directory.h |
@@ -6,8 +6,32 @@ |
#define BIN_DIRECTORY_H_ |
#include "bin/builtin.h" |
+#include "bin/dartutils.h" |
#include "platform/globals.h" |
+class DirectoryListing { |
+ public: |
+ enum Response { |
+ kListDirectory = 0, |
+ kListFile = 1, |
+ kListError = 2, |
+ kListDone = 3 |
+ }; |
+ |
+ explicit DirectoryListing(Dart_Port response_port) |
+ : response_port_(response_port) {} |
+ bool HandleDirectory(char* dir_name); |
+ bool HandleFile(char* file_name); |
+ bool HandleError(char* message); |
+ |
+ private: |
+ CObjectArray* NewResponse(Response response, char* arg); |
+ Dart_Port response_port_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DirectoryListing); |
+}; |
+ |
+ |
class Directory { |
public: |
enum ExistsResult { |
@@ -16,12 +40,17 @@ class Directory { |
DOES_NOT_EXIST |
}; |
- static void List(const char* path, |
+ enum DirectoryRequest { |
+ kCreateRequest = 0, |
+ kDeleteRequest = 1, |
+ kExistsRequest = 2, |
+ kCreateTempRequest = 3, |
+ kListRequest = 4 |
+ }; |
+ |
+ static bool List(const char* path, |
bool recursive, |
- Dart_Port dir_port, |
- Dart_Port file_port, |
- Dart_Port done_port, |
- Dart_Port error_port); |
+ DirectoryListing* listing); |
static ExistsResult Exists(const char* path); |
@@ -38,4 +67,5 @@ class Directory { |
DISALLOW_IMPLICIT_CONSTRUCTORS(Directory); |
}; |
+ |
#endif // BIN_DIRECTORY_H_ |