Skip to content

Commit

Permalink
Use helix-stdx tilde expansion and normalization for HELIX_RUNTIME paths
Browse files Browse the repository at this point in the history
Previously this wasn't possible since helix-core depends on helix-loader,
so helix-loader couldn't use helix-core's path extensions.

We use the path normalization/canonicalization for the runtime directory
provided by the HELIX_RUNTIME environment variable. This improves a
scenario where you set a path containing a tilde. Now that path will be
expanded and normalized.
  • Loading branch information
the-mikedavis authored and archseer committed Jan 18, 2024
1 parent 1f916e6 commit 1bc7aac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions helix-loader/Cargo.toml
Expand Up @@ -15,6 +15,8 @@ name = "hx-loader"
path = "src/main.rs"

[dependencies]
helix-stdx = { path = "../helix-stdx" }

anyhow = "1"
serde = { version = "1.0", features = ["derive"] }
toml = "0.7"
Expand Down
3 changes: 2 additions & 1 deletion helix-loader/src/lib.rs
Expand Up @@ -53,7 +53,8 @@ fn prioritize_runtime_dirs() -> Vec<PathBuf> {
rt_dirs.push(conf_rt_dir);

if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
rt_dirs.push(dir.into());
let dir = path::expand_tilde(dir);
rt_dirs.push(path::normalize(dir));
}

// If this variable is set during build time, it will always be included
Expand Down

0 comments on commit 1bc7aac

Please sign in to comment.