prevents from long stupid paths, and replace the home path by the literal `$HOME`
(a: &Path)
| 170 | |
| 171 | /// prevents from long stupid paths, and replace the home path by the literal `$HOME` |
| 172 | fn pretty_path(a: &Path) -> Result<String> { |
| 173 | #[cfg(unix)] |
| 174 | let home_var = "$HOME"; |
| 175 | #[cfg(windows)] |
| 176 | let home_var = "%userprofile%"; |
| 177 | Ok(a.display() |
| 178 | .to_string() |
| 179 | .replace(&home()?.display().to_string(), home_var)) |
| 180 | } |
| 181 | |
| 182 | /// thanks to @extrawurst for pointing this out |
| 183 | /// <https://github.com/extrawurst/gitui/blob/master/asyncgit/src/sync/branch/mod.rs#L38> |