| 519 | } |
| 520 | |
| 521 | Status S3FileSystem::CreateDir(const string& dirname) { |
| 522 | string bucket, object; |
| 523 | TF_RETURN_IF_ERROR(ParseS3Path(dirname, true, &bucket, &object)); |
| 524 | |
| 525 | if (object.empty()) { |
| 526 | Aws::S3::Model::HeadBucketRequest headBucketRequest; |
| 527 | headBucketRequest.WithBucket(bucket.c_str()); |
| 528 | auto headBucketOutcome = this->GetS3Client()->HeadBucket(headBucketRequest); |
| 529 | if (!headBucketOutcome.IsSuccess()) { |
| 530 | return errors::NotFound("The bucket ", bucket, " was not found."); |
| 531 | } |
| 532 | return Status::OK(); |
| 533 | } |
| 534 | string filename = dirname; |
| 535 | if (filename.back() != '/') { |
| 536 | filename.push_back('/'); |
| 537 | } |
| 538 | std::unique_ptr<WritableFile> file; |
| 539 | TF_RETURN_IF_ERROR(NewWritableFile(filename, &file)); |
| 540 | TF_RETURN_IF_ERROR(file->Close()); |
| 541 | return Status::OK(); |
| 542 | } |
| 543 | |
| 544 | Status S3FileSystem::DeleteDir(const string& dirname) { |
| 545 | string bucket, object; |