Get the output path for an archive with optional prefix.
(base: &Path, prefix: Option<&str>)
| 819 | |
| 820 | /// Get the output path for an archive with optional prefix. |
| 821 | pub 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 |
nothing calls this directly
no outgoing calls
no test coverage detected