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 <dirent.h> | 7 #include <dirent.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <sys/param.h> | 9 #include <sys/param.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 416 } |
417 | 417 |
418 | 418 |
419 bool Directory::Delete(const char* dir_name, bool recursive) { | 419 bool Directory::Delete(const char* dir_name, bool recursive) { |
420 if (!recursive) { | 420 if (!recursive) { |
421 return (TEMP_FAILURE_RETRY(remove(dir_name)) == 0); | 421 return (TEMP_FAILURE_RETRY(remove(dir_name)) == 0); |
422 } else { | 422 } else { |
423 return DeleteRecursively(dir_name); | 423 return DeleteRecursively(dir_name); |
424 } | 424 } |
425 } | 425 } |
| 426 |
| 427 |
| 428 bool Directory::Rename(const char* path, const char* new_path) { |
| 429 ExistsResult exists = Exists(path); |
| 430 if (exists != EXISTS) return false; |
| 431 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); |
| 432 } |
OLD | NEW |