| 1662 | } |
| 1663 | |
| 1664 | Status GcsFileSystem::IsDirectory(const string& fname) { |
| 1665 | string bucket, object; |
| 1666 | TF_RETURN_IF_ERROR(ParseGcsPath(fname, true, &bucket, &object)); |
| 1667 | if (object.empty()) { |
| 1668 | bool is_bucket; |
| 1669 | TF_RETURN_IF_ERROR(BucketExists(bucket, &is_bucket)); |
| 1670 | if (is_bucket) { |
| 1671 | return Status::OK(); |
| 1672 | } |
| 1673 | return errors::NotFound("The specified bucket gs://", bucket, |
| 1674 | " was not found."); |
| 1675 | } |
| 1676 | bool is_folder; |
| 1677 | TF_RETURN_IF_ERROR(FolderExists(fname, &is_folder)); |
| 1678 | if (is_folder) { |
| 1679 | return Status::OK(); |
| 1680 | } |
| 1681 | bool is_object; |
| 1682 | TF_RETURN_IF_ERROR(ObjectExists(fname, bucket, object, &is_object)); |
| 1683 | if (is_object) { |
| 1684 | return errors::FailedPrecondition("The specified path ", fname, |
| 1685 | " is not a directory."); |
| 1686 | } |
| 1687 | return errors::NotFound("The specified path ", fname, " was not found."); |
| 1688 | } |
| 1689 | |
| 1690 | Status GcsFileSystem::DeleteRecursively(const string& dirname, |
| 1691 | int64* undeleted_files, |