| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 | 349 |
| 350 bool Directory::Delete(const char* dir_name, bool recursive) { | 350 bool Directory::Delete(const char* dir_name, bool recursive) { |
| 351 if (!recursive) { | 351 if (!recursive) { |
| 352 if ((File::GetType(dir_name, false) == File::kIsLink) && | 352 if ((File::GetType(dir_name, false) == File::kIsLink) && |
| 353 (File::GetType(dir_name, true) == File::kIsDirectory)) { | 353 (File::GetType(dir_name, true) == File::kIsDirectory)) { |
| 354 return NO_RETRY_EXPECTED(unlink(dir_name)) == 0; | 354 return NO_RETRY_EXPECTED(unlink(dir_name)) == 0; |
| 355 } | 355 } |
| 356 return NO_RETRY_EXPECTED(rmdir(dir_name)) == 0; | 356 return NO_RETRY_EXPECTED(rmdir(dir_name)) == 0; |
| 357 } else { | 357 } else { |
| 358 // TODO(MG-416): After the issue is addressed, this can use the same code |
| 359 // as on Linux, etc. |
| 358 UNIMPLEMENTED(); | 360 UNIMPLEMENTED(); |
| 359 return false; | 361 return false; |
| 360 } | 362 } |
| 361 } | 363 } |
| 362 | 364 |
| 363 | 365 |
| 364 bool Directory::Rename(const char* path, const char* new_path) { | 366 bool Directory::Rename(const char* path, const char* new_path) { |
| 365 ExistsResult exists = Exists(path); | 367 ExistsResult exists = Exists(path); |
| 366 if (exists != EXISTS) { | 368 if (exists != EXISTS) { |
| 367 return false; | 369 return false; |
| 368 } | 370 } |
| 369 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0); | 371 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0); |
| 370 } | 372 } |
| 371 | 373 |
| 372 } // namespace bin | 374 } // namespace bin |
| 373 } // namespace dart | 375 } // namespace dart |
| 374 | 376 |
| 375 #endif // defined(TARGET_OS_FUCHSIA) | 377 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |