on master help sign in
Make the config dir locator work on Windows.
commit1f2d87cb950f165e8a805fc578d7921b48fbdedb authorBlaž Hrastnik <blaz@mxxn.io> dateMon 10 May 2021, 16:21 (5 years ago) parent37d32e2
3 files changed+18−11
Cargo.lock+12−7 helix-core/Cargo.toml+1−1 helix-core/src/lib.rs+5−3
Cargo.lock+12−7
@@ -150,6 +150,17 @@ dependencies = [
150150 "winapi",
151151]
152152
153+[[package]]
154+name = "etcetera"
155+version = "0.3.2"
156+source = "registry+https://github.com/rust-lang/crates.io-index"
157+checksum = "016b04fd1e94fb833d432634245c9bb61cf1c7409668a0e7d4c3ab00c5172dec"
158+dependencies = [
159+ "cfg-if",
160+ "dirs-next",
161+ "thiserror",
162+]
163+
153164[[package]]
154165name = "fern"
155166version = "0.6.0"
@@ -271,6 +282,7 @@ name = "helix-core"
271282version = "0.1.0"
272283dependencies = [
273284 "anyhow",
285+ "etcetera",
274286 "helix-syntax",
275287 "once_cell",
276288 "regex",
@@ -281,7 +293,6 @@ dependencies = [
281293 "tree-sitter",
282294 "unicode-segmentation",
283295 "unicode-width",
284− "xdg",
285296]
286297
287298[[package]]
@@ -1090,9 +1101,3 @@ name = "winapi-x86_64-pc-windows-gnu"
10901101version = "0.4.0"
10911102source = "registry+https://github.com/rust-lang/crates.io-index"
10921103checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1093−
1094−[[package]]
1095−name = "xdg"
1096−version = "2.2.0"
1097−source = "registry+https://github.com/rust-lang/crates.io-index"
1098−checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
helix-core/Cargo.toml+1−1
@@ -22,4 +22,4 @@ regex = "1"
2222
2323serde = { version = "1.0", features = ["derive"] }
2424
25−xdg = "2.0"
25+etcetera = "0.3"
helix-core/src/lib.rs+5−3
@@ -58,9 +58,11 @@ pub fn runtime_dir() -> std::path::PathBuf {
5858
5959pub fn config_dir() -> std::path::PathBuf {
6060 // TODO: allow env var override
61− let xdg_dirs =
62− xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!");
63− xdg_dirs.get_config_home()
61+ use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
62+ let strategy = choose_base_strategy().expect("Unable to find the config directory!");
63+ let mut path = strategy.config_dir();
64+ path.push("helix");
65+ path
6466}
6567
6668pub use ropey::{Rope, RopeSlice};