in cargo-guppy/src/mv.rs [265:278]
fn canonicalize_dir(pkg_graph: &PackageGraph, path: impl AsRef<Utf8Path>) -> Result<Utf8PathBuf> {
let workspace = pkg_graph.workspace();
let workspace_root = workspace.root();
let path = path.as_ref();
let canonical_path = path
.canonicalize()
.wrap_err_with(|| eyre!("reading path {} failed", path))?;
if !canonical_path.is_dir() {
bail!("path {} is not a directory", canonical_path.display());
}
Ok(rel_path(&canonical_path, workspace_root)?.to_path_buf())
}