diff options
author | Michael Davis | 2024-01-16 18:59:48 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2024-01-18 01:57:53 +0000 |
commit | 1f916e65cff4459698d465b2f4558da1e1bf6e44 (patch) | |
tree | 5b6768e3069085bc5ba995efa95fdc73241ed0f6 /helix-view/src/document.rs | |
parent | af8e524a7d06253fa854bf8954f64312e11d0ea0 (diff) |
Create helix-stdx crate for stdlib extensions
helix-stdx is meant to carry extensions to the stdlib or low-level
dependencies that are useful in all other crates. This commit starts
with all of the path functions from helix-core and the CWD tracking that
lived in helix-loader.
The CWD tracking in helix-loader was previously unable to call the
canonicalization functions in helix-core. Switching to our custom
canonicalization code should make no noticeable difference though
since `std::env::current_dir` returns a canonicalized path with
symlinks resolved (at least on unix).
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r-- | helix-view/src/document.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 0de0cd17..6473c2d1 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -855,7 +855,7 @@ impl Document { let text = self.text().clone(); let path = match path { - Some(path) => helix_core::path::get_canonicalized_path(&path), + Some(path) => helix_stdx::path::canonicalize(path), None => { if self.path.is_none() { bail!("Can't save with no path set!"); @@ -1049,7 +1049,7 @@ impl Document { } pub fn set_path(&mut self, path: Option<&Path>) { - let path = path.map(helix_core::path::get_canonicalized_path); + let path = path.map(helix_stdx::path::canonicalize); // if parent doesn't exist we still want to open the document // and error out when document is saved @@ -1672,7 +1672,7 @@ impl Document { pub fn relative_path(&self) -> Option<PathBuf> { self.path .as_deref() - .map(helix_core::path::get_relative_path) + .map(helix_stdx::path::get_relative_path) } pub fn display_name(&self) -> Cow<'static, str> { |