| 207 | } |
| 208 | |
| 209 | Status DeleteDirContents(const std::string& path, bool missing_dir_ok) { |
| 210 | auto st = CheckForDirectory(path, "delete contents of"); |
| 211 | if (!st.ok()) { |
| 212 | if (missing_dir_ok && ErrnoFromStatus(st) == ENOENT) { |
| 213 | return Status::OK(); |
| 214 | } |
| 215 | return st; |
| 216 | } |
| 217 | |
| 218 | std::vector<std::string> file_list; |
| 219 | RETURN_NOT_OK(client_->GetChildren(path, &file_list)); |
| 220 | for (const auto& file : file_list) { |
| 221 | RETURN_NOT_OK(client_->Delete(file, /*recursive=*/true)); |
| 222 | } |
| 223 | return Status::OK(); |
| 224 | } |
| 225 | |
| 226 | Status DeleteFile(const std::string& path) { |
| 227 | if (IsDirectory(path)) { |
nothing calls this directly
no test coverage detected