| OLD | NEW |
| 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 #include "bin/directory.h" | 5 #include "bin/directory.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 | 9 |
| 10 #include "bin/platform.h" | 10 #include "bin/platform.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 free(path); | 158 free(path); |
| 159 return false; | 159 return false; |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool success = HandleEntry(&find_file_data, | 162 bool success = HandleEntry(&find_file_data, |
| 163 path, | 163 path, |
| 164 path_length, | 164 path_length, |
| 165 recursive, | 165 recursive, |
| 166 listing); | 166 listing); |
| 167 | 167 |
| 168 while ((FindNextFile(find_handle, &find_file_data) != 0) && success) { | 168 while ((FindNextFile(find_handle, &find_file_data) != 0)) { |
| 169 success = success && HandleEntry(&find_file_data, | 169 success = HandleEntry(&find_file_data, |
| 170 path, | 170 path, |
| 171 path_length, | 171 path_length, |
| 172 recursive, | 172 recursive, |
| 173 listing); | 173 listing) && success; |
| 174 } | 174 } |
| 175 | 175 |
| 176 if (GetLastError() != ERROR_NO_MORE_FILES) { | 176 if (GetLastError() != ERROR_NO_MORE_FILES) { |
| 177 success = false; | 177 success = false; |
| 178 PostError(listing, dir_name); | 178 PostError(listing, dir_name); |
| 179 } | 179 } |
| 180 | 180 |
| 181 if (FindClose(find_handle) == 0) { | 181 if (FindClose(find_handle) == 0) { |
| 182 success = false; | 182 success = false; |
| 183 PostError(listing, dir_name); | 183 PostError(listing, dir_name); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 | 377 |
| 378 bool Directory::Delete(const char* dir_name, bool recursive) { | 378 bool Directory::Delete(const char* dir_name, bool recursive) { |
| 379 if (!recursive) { | 379 if (!recursive) { |
| 380 return (RemoveDirectory(dir_name) != 0); | 380 return (RemoveDirectory(dir_name) != 0); |
| 381 } else { | 381 } else { |
| 382 return DeleteRecursively(dir_name); | 382 return DeleteRecursively(dir_name); |
| 383 } | 383 } |
| 384 } | 384 } |
| OLD | NEW |