| 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 } | 476 } |
| 476 | 477 |
| 477 | 478 |
| 478 bool Directory::Rename(const char* path, const char* new_path) { | 479 bool Directory::Rename(const char* path, const char* new_path) { |
| 479 ExistsResult exists = Exists(path); | 480 ExistsResult exists = Exists(path); |
| 480 if (exists != EXISTS) return false; | 481 if (exists != EXISTS) return false; |
| 481 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); | 482 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); |
| 482 } | 483 } |
| 483 | 484 |
| 484 #endif // defined(TARGET_OS_MACOS) | 485 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |