| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 DirectoryListing* listing) { | 46 DirectoryListing* listing) { |
| 47 if (strcmp(dir_name, ".") != 0 && | 47 if (strcmp(dir_name, ".") != 0 && |
| 48 strcmp(dir_name, "..") != 0) { | 48 strcmp(dir_name, "..") != 0) { |
| 49 size_t written = snprintf(path + path_length, | 49 size_t written = snprintf(path + path_length, |
| 50 MAX_PATH - path_length, | 50 MAX_PATH - path_length, |
| 51 "%s", | 51 "%s", |
| 52 dir_name); | 52 dir_name); |
| 53 if (written != strlen(dir_name)) { | 53 if (written != strlen(dir_name)) { |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 bool ok = listing->HandleDirectory(dir_name); | 56 bool ok = listing->HandleDirectory(path); |
| 57 if (!ok) return ok; | 57 if (!ok) return ok; |
| 58 if (recursive) { | 58 if (recursive) { |
| 59 return ListRecursively(path, recursive, listing); | 59 return ListRecursively(path, recursive, listing); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 static bool HandleFile(char* file_name, | 66 static bool HandleFile(char* file_name, |
| (...skipping 328 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 |