| 535 | } |
| 536 | |
| 537 | Status MockFileSystem::DeleteFile(const std::string& path) { |
| 538 | RETURN_NOT_OK(ValidatePath(path)); |
| 539 | auto parts = SplitAbstractPath(path); |
| 540 | RETURN_NOT_OK(ValidateAbstractPathParts(parts)); |
| 541 | |
| 542 | auto guard = impl_->lock_guard(); |
| 543 | |
| 544 | Entry* parent = impl_->FindParent(parts); |
| 545 | if (parent == nullptr || !parent->is_dir()) { |
| 546 | return PathNotFound(path); |
| 547 | } |
| 548 | Directory& parent_dir = parent->as_dir(); |
| 549 | auto child = parent_dir.Find(parts.back()); |
| 550 | if (child == nullptr) { |
| 551 | return PathNotFound(path); |
| 552 | } |
| 553 | if (!child->is_file()) { |
| 554 | return NotAFile(path); |
| 555 | } |
| 556 | bool deleted = parent_dir.DeleteEntry(parts.back()); |
| 557 | DCHECK(deleted); |
| 558 | return Status::OK(); |
| 559 | } |
| 560 | |
| 561 | Result<FileInfo> MockFileSystem::GetFileInfo(const std::string& path) { |
| 562 | RETURN_NOT_OK(ValidatePath(path)); |
nothing calls this directly
no test coverage detected