diff options
author | Blaž Hrastnik | 2021-11-21 11:06:45 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-11-21 11:06:45 +0000 |
commit | d1854d8e6af07cd78ab6c24c859a4471afb3514e (patch) | |
tree | 301e4212e7fc88dd5f626f884bd78b700cf3e4a6 /helix-core/src/path.rs | |
parent | 8b85903116fdfdc177bf2ca171831674144de70a (diff) | |
parent | b95c9470de9f9199f109fdbfb6ec9a951fbe8866 (diff) |
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'helix-core/src/path.rs')
-rw-r--r-- | helix-core/src/path.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-core/src/path.rs b/helix-core/src/path.rs index 6c37cfa1..a6644465 100644 --- a/helix-core/src/path.rs +++ b/helix-core/src/path.rs @@ -40,7 +40,6 @@ pub fn expand_tilde(path: &Path) -> PathBuf { /// needs to improve on. /// Copied from cargo: <https://github.com/rust-lang/cargo/blob/070e459c2d8b79c5b2ac5218064e7603329c92ae/crates/cargo-util/src/paths.rs#L81> pub fn get_normalized_path(path: &Path) -> PathBuf { - let path = expand_tilde(path); let mut components = path.components().peekable(); let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { components.next(); @@ -72,10 +71,11 @@ pub fn get_normalized_path(path: &Path) -> PathBuf { /// This function is used instead of `std::fs::canonicalize` because we don't want to verify /// here if the path exists, just normalize it's components. pub fn get_canonicalized_path(path: &Path) -> std::io::Result<PathBuf> { + let path = expand_tilde(path); let path = if path.is_relative() { std::env::current_dir().map(|current_dir| current_dir.join(path))? } else { - path.to_path_buf() + path }; Ok(get_normalized_path(path.as_path())) |