Skip to main content

resolve_mount_src

Function resolve_mount_src 

Source
pub fn resolve_mount_src(source: &Utf8Path, src: &str) -> Utf8PathBuf
Expand description

Resolve a [[mount.entry]] src = "..." value to an absolute path. ~ and ~/... expand to the home directory; absolute inputs are returned verbatim (so a private clone at ~/.dotfiles-private/home mounts directly without symlinking). Anything else is treated as relative to source (the dotfiles repo root) — the historical default.

Implementation detail: Utf8PathBuf::join already replaces the base with absolute arguments, so we just need expand_tilde first to handle the ~ form.

If expand_tilde couldn’t resolve ~ (both HOME and USERPROFILE unset), it returns the input verbatim — in that case we MUST NOT rebase it under source, because <source>/~/foo silently resolves to a wrong tree instead of surfacing the unset-home configuration error. Return the unresolved ~ form so the caller hits a clear “no such path” later. (Caught in PR #56 review by coderabbitai.)