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

Function canonicalize_path

flow-quickstart/src/git.rs:108–116  ·  view source on GitHub ↗
(p: &Path)

Source from the content-addressed store, hash-verified

106}
107
108fn canonicalize_path(p: &Path) -> Result<PathBuf> {
109 let p = if p.to_str().unwrap().starts_with("~/") {
110 home()?.join(p.strip_prefix("~/").unwrap())
111 } else {
112 p.to_path_buf()
113 };
114
115 p.canonicalize().context("path does not exist")
116}
117
118#[test]
119fn should_canonicalize() {

Callers 3

newMethod · 0.85
get_private_key_pathFunction · 0.85
homeFunction · 0.85

Calls 1

homeFunction · 0.85

Tested by

no test coverage detected