| 693 | } |
| 694 | |
| 695 | Status MockFileSystem::CopyFile(const std::string& src, const std::string& dest) { |
| 696 | return BinaryOp::Run(impl_.get(), src, dest, [&](const BinaryOp& op) -> Status { |
| 697 | if (op.src_entry == nullptr) { |
| 698 | return PathNotFound(src); |
| 699 | } |
| 700 | if (!op.src_entry->is_file()) { |
| 701 | return NotAFile(src); |
| 702 | } |
| 703 | if (op.dest_entry != nullptr && op.dest_entry->is_dir()) { |
| 704 | return Status::IOError("Cannot replace destination '", dest, |
| 705 | "', which is a directory"); |
| 706 | } |
| 707 | |
| 708 | // Copy original entry, fix its name |
| 709 | std::unique_ptr<Entry> new_entry(new Entry(File(op.src_entry->as_file()))); |
| 710 | new_entry->SetName(op.dest_name); |
| 711 | op.dest_dir.AssignEntry(op.dest_name, std::move(new_entry)); |
| 712 | return Status::OK(); |
| 713 | }); |
| 714 | } |
| 715 | |
| 716 | Result<std::shared_ptr<io::InputStream>> MockFileSystem::OpenInputStream( |
| 717 | const std::string& path) { |
nothing calls this directly
no test coverage detected