Index: runtime/bin/directory_win.cc |
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc |
index a9efc479d0ece06988bf46e1d2d0f20506692a25..f8af2133edbcf42b088e2a88ae00acc5962aea1b 100644 |
--- a/runtime/bin/directory_win.cc |
+++ b/runtime/bin/directory_win.cc |
@@ -4,21 +4,11 @@ |
#include "bin/directory.h" |
-bool Directory::Open(const char* path, intptr_t* dir) { |
- return true; |
-} |
- |
- |
-bool Directory::Close(intptr_t dir) { |
- return true; |
-} |
- |
- |
static void HandleDir(char* dir_name, |
char* path, |
int path_length, |
- Dart_Port dir_handler) { |
- if (dir_handler != 0 && |
+ Dart_Port dir_port) { |
+ if (dir_port != 0 && |
strcmp(dir_name, ".") != 0 && |
strcmp(dir_name, "..") != 0) { |
size_t written = snprintf(path + path_length, |
@@ -27,7 +17,7 @@ static void HandleDir(char* dir_name, |
dir_name); |
ASSERT(written == strlen(dir_name)); |
Dart_Handle name = Dart_NewString(path); |
- Dart_Post(dir_handler, name); |
+ Dart_Post(dir_port, name); |
} |
} |
@@ -35,15 +25,15 @@ static void HandleDir(char* dir_name, |
static void HandleFile(char* file_name, |
char* path, |
int path_length, |
- Dart_Port file_handler) { |
- if (file_handler != 0) { |
+ Dart_Port file_port) { |
+ if (file_port != 0) { |
size_t written = snprintf(path + path_length, |
MAX_PATH - path_length, |
"%s", |
file_name); |
ASSERT(written == strlen(file_name)); |
Dart_Handle name = Dart_NewString(path); |
- Dart_Post(file_handler, name); |
+ Dart_Post(file_port, name); |
} |
} |
@@ -51,13 +41,13 @@ static void HandleFile(char* file_name, |
static void HandleEntry(LPWIN32_FIND_DATA find_file_data, |
char* path, |
int path_length, |
- Dart_Port file_handler, |
- Dart_Port dir_handler) { |
+ Dart_Port file_port, |
+ Dart_Port dir_port) { |
DWORD attributes = find_file_data->dwFileAttributes; |
if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { |
- HandleDir(find_file_data->cFileName, path, path_length, dir_handler); |
+ HandleDir(find_file_data->cFileName, path, path_length, dir_port); |
} else { |
- HandleFile(find_file_data->cFileName, path, path_length, file_handler); |
+ HandleFile(find_file_data->cFileName, path, path_length, file_port); |
} |
} |
@@ -81,12 +71,11 @@ static void ComputeFullSearchPath(const char* dir_name, |
void Directory::List(const char* dir_name, |
- intptr_t dir, |
bool recursive, |
- Dart_Port dir_handler, |
- Dart_Port file_handler, |
- Dart_Port done_handler, |
- Dart_Port dir_error_handler) { |
+ Dart_Port dir_port, |
+ Dart_Port file_port, |
+ Dart_Port done_port, |
+ Dart_Port error_port) { |
// TODO(ager): Handle recursive listing. |
char path[MAX_PATH]; |
int path_length = 0; |
@@ -100,21 +89,21 @@ void Directory::List(const char* dir_name, |
path[path_length] = '\0'; |
if (find_handle == INVALID_HANDLE_VALUE) { |
+ // TODO(ager): Post on error port. |
Dart_Handle value = Dart_NewBoolean(false); |
- Dart_Post(done_handler, value); |
+ Dart_Post(done_port, value); |
return; |
} |
- HandleEntry(&find_file_data, path, path_length, file_handler, dir_handler); |
+ HandleEntry(&find_file_data, path, path_length, file_port, dir_port); |
while (FindNextFile(find_handle, &find_file_data) != 0) { |
- HandleEntry(&find_file_data, path, path_length, file_handler, dir_handler); |
+ HandleEntry(&find_file_data, path, path_length, file_port, dir_port); |
} |
bool result = GetLastError() == ERROR_NO_MORE_FILES; |
- BOOL closed = FindClose(find_handle); |
- if (!closed) { |
- result = false; |
- } |
Dart_Handle value = Dart_NewBoolean(result); |
- Dart_Post(done_handler, value); |
+ Dart_Post(done_port, value); |
+ |
+ // TODO(ager): Post on error port. |
+ FindClose(find_handle); |
} |