Derive the `.snap` path from the `.partial` path (same directory, stem only).
(partial: &std::path::Path)
| 123 | |
| 124 | /// Derive the `.snap` path from the `.partial` path (same directory, stem only). |
| 125 | fn snap_path_for(partial: &std::path::Path) -> PathBuf { |
| 126 | let parent = partial |
| 127 | .parent() |
| 128 | .unwrap_or_else(|| std::path::Path::new(".")); |
| 129 | let stem = partial |
| 130 | .file_stem() |
| 131 | .unwrap_or_else(|| std::ffi::OsStr::new("unknown")); |
| 132 | parent.join(format!("{}.snap", stem.to_string_lossy())) |
| 133 | } |