(&self, file: &Path)
| 415 | } |
| 416 | |
| 417 | pub fn read_child(&self, file: &Path) -> anyhow::Result<Vec<u8>> { |
| 418 | match &self.kind { |
| 419 | PathKind::Path => { |
| 420 | anyhow::ensure!( |
| 421 | matches!(self.compression, Compression::None), |
| 422 | "attempted to read compressed file as a directory: {}", |
| 423 | self.path.display() |
| 424 | ); |
| 425 | |
| 426 | let file_path = self.path.join(file); |
| 427 | std::fs::read(&file_path) |
| 428 | .with_context(|| format!("failed to read: {}", file_path.display())) |
| 429 | } |
| 430 | PathKind::Tar { subpath } => { |
| 431 | let file_path = subpath.as_deref().unwrap_or(Path::new("")).join(file); |
| 432 | read_within(&self.path, &file_path, &self.compression) |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | fn read_within( |
no test coverage detected