MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / archive_file_list

Function archive_file_list

xtask/src/main.rs:9317–9348  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

9315}
9316
9317fn archive_file_list(path: &Path) -> Result<Vec<String>> {
9318 let bytes = fs::read(path).with_context(|| format!("read {}", path.display()))?;
9319 let raw = if bytes.starts_with(&[0x28, 0xb5, 0x2f, 0xfd]) {
9320 let mut decoder = zstd::stream::read::Decoder::new(std::io::Cursor::new(bytes))
9321 .with_context(|| format!("create zstd decoder for {}", path.display()))?;
9322 let mut raw = Vec::new();
9323 io::copy(&mut decoder, &mut raw)
9324 .with_context(|| format!("decompress {}", path.display()))?;
9325 raw
9326 } else {
9327 bytes
9328 };
9329 let mut archive = tar::Archive::new(std::io::Cursor::new(raw));
9330 let mut files = Vec::new();
9331 for entry in archive
9332 .entries()
9333 .with_context(|| format!("read tar entries from {}", path.display()))?
9334 {
9335 let entry = entry.with_context(|| format!("read tar entry from {}", path.display()))?;
9336 if entry.header().entry_type().is_file() {
9337 files.push(
9338 entry
9339 .path()
9340 .with_context(|| format!("read tar path from {}", path.display()))?
9341 .to_string_lossy()
9342 .replace('\\', "/"),
9343 );
9344 }
9345 }
9346 files.sort();
9347 Ok(files)
9348}
9349
9350fn append_tree<W: io::Write>(
9351 builder: &mut tar::Builder<W>,

Callers 1

write_asset_manifestFunction · 0.85

Calls 2

pushMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected