MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_archive_path

Function get_archive_path

atomic-repository/src/archive.rs:821–832  ·  view source on GitHub ↗

Get the output path for an archive with optional prefix.

(base: &Path, prefix: Option<&str>)

Source from the content-addressed store, hash-verified

819
820/// Get the output path for an archive with optional prefix.
821pub fn get_archive_path(base: &Path, prefix: Option<&str>) -> PathBuf {
822 match prefix {
823 Some(p) => {
824 let stem = base
825 .file_stem()
826 .map(|s| s.to_string_lossy().to_string())
827 .unwrap_or_else(|| "archive".to_string());
828 base.with_file_name(format!("{}-{}", p.trim_end_matches('/'), stem))
829 }
830 None => base.to_path_buf(),
831 }
832}
833
834// Tests
835

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected