Use `expanduser` when `~` is detected in paths
Use
expanduserwhen~is detected in paths