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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return NO_RETRY_EXPECTED(closedir(dir_pointer)) == 0 && | 262 return NO_RETRY_EXPECTED(closedir(dir_pointer)) == 0 && |
263 NO_RETRY_EXPECTED(remove(path->AsString())) == 0; | 263 NO_RETRY_EXPECTED(remove(path->AsString())) == 0; |
264 } | 264 } |
265 bool ok = false; | 265 bool ok = false; |
266 switch (entry.d_type) { | 266 switch (entry.d_type) { |
267 case DT_DIR: | 267 case DT_DIR: |
268 ok = DeleteDir(entry.d_name, path); | 268 ok = DeleteDir(entry.d_name, path); |
269 break; | 269 break; |
270 case DT_REG: | 270 case DT_REG: |
271 case DT_LNK: | 271 case DT_LNK: |
| 272 case DT_SOCK: |
272 // Treat all links as files. This will delete the link which | 273 // Treat all links as files. This will delete the link which |
273 // is what we want no matter if the link target is a file or a | 274 // is what we want no matter if the link target is a file or a |
274 // directory. | 275 // directory. |
275 ok = DeleteFile(entry.d_name, path); | 276 ok = DeleteFile(entry.d_name, path); |
276 break; | 277 break; |
277 case DT_UNKNOWN: { | 278 case DT_UNKNOWN: { |
278 if (!path->Add(entry.d_name)) { | 279 if (!path->Add(entry.d_name)) { |
279 break; | 280 break; |
280 } | 281 } |
281 // On some file systems the entry type is not determined by | 282 // On some file systems the entry type is not determined by |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 bool Directory::Rename(const char* path, const char* new_path) { | 426 bool Directory::Rename(const char* path, const char* new_path) { |
426 ExistsResult exists = Exists(path); | 427 ExistsResult exists = Exists(path); |
427 if (exists != EXISTS) return false; | 428 if (exists != EXISTS) return false; |
428 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0); | 429 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0); |
429 } | 430 } |
430 | 431 |
431 } // namespace bin | 432 } // namespace bin |
432 } // namespace dart | 433 } // namespace dart |
433 | 434 |
434 #endif // defined(TARGET_OS_MACOS) | 435 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |