| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 | 9 |
| 10 #include <dirent.h> // NOLINT | 10 #include <dirent.h> // NOLINT |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 while ((status = TEMP_FAILURE_RETRY(readdir_r(dir_pointer, | 146 while ((status = TEMP_FAILURE_RETRY(readdir_r(dir_pointer, |
| 147 &entry, | 147 &entry, |
| 148 &result))) == 0 && | 148 &result))) == 0 && |
| 149 result != NULL) { | 149 result != NULL) { |
| 150 switch (entry.d_type) { | 150 switch (entry.d_type) { |
| 151 case DT_DIR: | 151 case DT_DIR: |
| 152 success = HandleDir(entry.d_name, | 152 success = HandleDir(entry.d_name, |
| 153 path, | 153 path, |
| 154 recursive, | 154 recursive, |
| 155 follow_links, | 155 follow_links, |
| 156 seen, |
| 156 listing) && success; | 157 listing) && success; |
| 157 break; | 158 break; |
| 158 case DT_REG: | 159 case DT_REG: |
| 159 success = HandleFile(entry.d_name, | 160 success = HandleFile(entry.d_name, |
| 160 path, | 161 path, |
| 161 listing) && success; | 162 listing) && success; |
| 162 break; | 163 break; |
| 163 case DT_LNK: | 164 case DT_LNK: |
| 164 if (!follow_links) { | 165 if (!follow_links) { |
| 165 success = HandleLink(entry.d_name, | 166 success = HandleLink(entry.d_name, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 listing) && success; | 230 listing) && success; |
| 230 break; | 231 break; |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 path->Reset(path_length); | 234 path->Reset(path_length); |
| 234 if (S_ISDIR(entry_info.st_mode)) { | 235 if (S_ISDIR(entry_info.st_mode)) { |
| 235 success = HandleDir(entry.d_name, | 236 success = HandleDir(entry.d_name, |
| 236 path, | 237 path, |
| 237 recursive, | 238 recursive, |
| 238 follow_links, | 239 follow_links, |
| 240 seen, |
| 239 listing) && success; | 241 listing) && success; |
| 240 } else if (S_ISREG(entry_info.st_mode)) { | 242 } else if (S_ISREG(entry_info.st_mode)) { |
| 241 success = HandleFile(entry.d_name, | 243 success = HandleFile(entry.d_name, |
| 242 path, | 244 path, |
| 243 listing) && success; | 245 listing) && success; |
| 244 } else if (S_ISLNK(entry_info.st_mode)) { | 246 } else if (S_ISLNK(entry_info.st_mode)) { |
| 245 success = HandleLink(entry.d_name, | 247 success = HandleLink(entry.d_name, |
| 246 path, | 248 path, |
| 247 listing) && success; | 249 listing) && success; |
| 248 } | 250 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 509 } |
| 508 | 510 |
| 509 | 511 |
| 510 bool Directory::Rename(const char* path, const char* new_path) { | 512 bool Directory::Rename(const char* path, const char* new_path) { |
| 511 ExistsResult exists = Exists(path); | 513 ExistsResult exists = Exists(path); |
| 512 if (exists != EXISTS) return false; | 514 if (exists != EXISTS) return false; |
| 513 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); | 515 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); |
| 514 } | 516 } |
| 515 | 517 |
| 516 #endif // defined(TARGET_OS_ANDROID) | 518 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |