| 571 | } |
| 572 | |
| 573 | Status Move(const GcsPath& src, const GcsPath& dest) { |
| 574 | if (src == dest) return Status::OK(); |
| 575 | if (src.object.empty()) { |
| 576 | return Status::IOError( |
| 577 | "Moving directories or buckets cannot be implemented in GCS. You provided (", |
| 578 | src.full_path, ") as a source for Move()"); |
| 579 | } |
| 580 | ARROW_ASSIGN_OR_RAISE(auto info, GetFileInfo(dest)); |
| 581 | if (info.IsDirectory()) { |
| 582 | return Status::IOError("Attempting to Move() '", info.path(), |
| 583 | "' to an existing directory"); |
| 584 | } |
| 585 | ARROW_ASSIGN_OR_RAISE(auto src_info, GetFileInfo(src)); |
| 586 | if (!src_info.IsFile()) { |
| 587 | return Status::IOError("Cannot move source '", src.full_path, |
| 588 | "' the object does not exist or does not represent a file"); |
| 589 | } |
| 590 | RETURN_NOT_OK(CopyFile(src, dest)); |
| 591 | return DeleteFile(src); |
| 592 | } |
| 593 | |
| 594 | Status CopyFile(const GcsPath& src, const GcsPath& dest) { |
| 595 | auto parent = dest.parent(); |
nothing calls this directly
no test coverage detected