| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "bin/directory.h" | 5 #include "bin/directory.h" |
| 6 | 6 |
| 7 // Forward declaration. | 7 // Forward declaration. |
| 8 static bool ListRecursively(const char* dir_name, | 8 static bool ListRecursively(const char* dir_name, |
| 9 bool recursive, | 9 bool recursive, |
| 10 Dart_Port dir_port, | 10 Dart_Port dir_port, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 completed = completed && (GetLastError() == ERROR_NO_MORE_FILES); | 149 completed = completed && (GetLastError() == ERROR_NO_MORE_FILES); |
| 150 | 150 |
| 151 // TODO(ager): Post on error port if close fails. | 151 // TODO(ager): Post on error port if close fails. |
| 152 FindClose(find_handle); | 152 FindClose(find_handle); |
| 153 free(path); | 153 free(path); |
| 154 | 154 |
| 155 return completed; | 155 return completed; |
| 156 } | 156 } |
| 157 | 157 |
| 158 |
| 158 void Directory::List(const char* dir_name, | 159 void Directory::List(const char* dir_name, |
| 159 bool recursive, | 160 bool recursive, |
| 160 Dart_Port dir_port, | 161 Dart_Port dir_port, |
| 161 Dart_Port file_port, | 162 Dart_Port file_port, |
| 162 Dart_Port done_port, | 163 Dart_Port done_port, |
| 163 Dart_Port error_port) { | 164 Dart_Port error_port) { |
| 164 bool result = ListRecursively(dir_name, | 165 bool result = ListRecursively(dir_name, |
| 165 recursive, | 166 recursive, |
| 166 dir_port, | 167 dir_port, |
| 167 file_port, | 168 file_port, |
| 168 done_port, | 169 done_port, |
| 169 error_port); | 170 error_port); |
| 170 if (done_port != 0) { | 171 if (done_port != 0) { |
| 171 Dart_Handle value = Dart_NewBoolean(result); | 172 Dart_Handle value = Dart_NewBoolean(result); |
| 172 Dart_Post(done_port, value); | 173 Dart_Post(done_port, value); |
| 173 } | 174 } |
| 174 } | 175 } |
| 176 |
| 177 |
| 178 bool Directory::Exists(const char* dir_name, bool* result) { |
| 179 UNIMPLEMENTED(); |
| 180 return false; |
| 181 } |
| 182 |
| 183 |
| 184 bool Directory::Create(const char* dir_name) { |
| 185 UNIMPLEMENTED(); |
| 186 return false; |
| 187 } |
| 188 |
| 189 |
| 190 bool Directory::Delete(const char* dir_name) { |
| 191 UNIMPLEMENTED(); |
| 192 return false; |
| 193 } |
| OLD | NEW |