| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 char* path, | 67 char* path, |
| 68 int path_length, | 68 int path_length, |
| 69 DirectoryListing* listing) { | 69 DirectoryListing* listing) { |
| 70 size_t written = snprintf(path + path_length, | 70 size_t written = snprintf(path + path_length, |
| 71 MAX_PATH - path_length, | 71 MAX_PATH - path_length, |
| 72 "%s", | 72 "%s", |
| 73 file_name); | 73 file_name); |
| 74 if (written != strlen(file_name)) { | 74 if (written != strlen(file_name)) { |
| 75 return false; | 75 return false; |
| 76 }; | 76 }; |
| 77 return listing->HandleFile(file_name); | 77 return listing->HandleFile(path); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 static bool HandleEntry(LPWIN32_FIND_DATA find_file_data, | 81 static bool HandleEntry(LPWIN32_FIND_DATA find_file_data, |
| 82 char* path, | 82 char* path, |
| 83 int path_length, | 83 int path_length, |
| 84 bool recursive, | 84 bool recursive, |
| 85 DirectoryListing* listing) { | 85 DirectoryListing* listing) { |
| 86 DWORD attributes = find_file_data->dwFileAttributes; | 86 DWORD attributes = find_file_data->dwFileAttributes; |
| 87 if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { | 87 if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 395 } |
| 396 | 396 |
| 397 | 397 |
| 398 bool Directory::Delete(const char* dir_name, bool recursive) { | 398 bool Directory::Delete(const char* dir_name, bool recursive) { |
| 399 if (!recursive) { | 399 if (!recursive) { |
| 400 return (RemoveDirectory(dir_name) != 0); | 400 return (RemoveDirectory(dir_name) != 0); |
| 401 } else { | 401 } else { |
| 402 return DeleteRecursively(dir_name); | 402 return DeleteRecursively(dir_name); |
| 403 } | 403 } |
| 404 } | 404 } |
| OLD | NEW |