From 215e79bdef93422a93f7ebf88e4ec91492d60c5b Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 16 Jan 2024 14:00:06 -0500 Subject: [PATCH] Use helix-stdx tilde expansion and normalization for HELIX_RUNTIME paths 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. --- Cargo.lock | 1 + helix-loader/Cargo.toml | 2 ++ helix-loader/src/lib.rs | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 09bec59f0c9a..9884dadfb64a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1114,6 +1114,7 @@ dependencies = [ "cc", "dunce", "etcetera", + "helix-stdx", "libloading", "log", "once_cell", diff --git a/helix-loader/Cargo.toml b/helix-loader/Cargo.toml index 1874753851ff..08da7f295e45 100644 --- a/helix-loader/Cargo.toml +++ b/helix-loader/Cargo.toml @@ -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" diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 991504fb8e82..f8fac67035e5 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -53,7 +53,8 @@ fn prioritize_runtime_dirs() -> Vec { 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