Unified · Split
| @@ -23,13 +23,12 @@ impl Url { · 22 unmodified lines | ||
| 23 | 23 | &self, |
| 24 | 24 | home_for_user: impl FnOnce(&UserExpansion) -> Option<PathBuf>, |
| 25 | 25 | ) -> Result<PathBuf, Error> { |
| 26 | − fn join_relative(mut base: PathBuf, path: &Path) -> PathBuf { | |
| 27 | − base.extend(path.components().skip(1)); | |
| 28 | − base | |
| 26 | + fn make_relative(path: &Path) -> PathBuf { | |
| 27 | + path.components().skip(1).collect() | |
| 29 | 28 | } |
| 30 | 29 | let path = self.path.to_path()?; |
| 31 | 30 | Ok(match self.expansion.as_ref() { |
| 32 | − Some(user) => join_relative(home_for_user(user).ok_or(Error::MissingHome)?, path), | |
| 31 | + Some(user) => home_for_user(user).ok_or(Error::MissingHome)?.join(make_relative(path)), | |
| 33 | 32 | None => self.path.to_path()?.into(), |
| 34 | 33 | }) |
| 35 | 34 | } |