MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / pretty_path

Function pretty_path

flow-quickstart/src/git.rs:172–180  ·  view source on GitHub ↗

prevents from long stupid paths, and replace the home path by the literal `$HOME`

(a: &Path)

Source from the content-addressed store, hash-verified

170
171/// prevents from long stupid paths, and replace the home path by the literal `$HOME`
172fn 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>

Callers

nothing calls this directly

Calls 1

homeFunction · 0.85

Tested by

no test coverage detected