on master help sign in
Make the config dir locator work on Windows.
1f2d87cBlaž Hrastnik
Cargo.lock+12−7
@@ -150,6 +150,17 @@ dependencies = [
150 "winapi",
150 "winapi",
151]
151]
152
152
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+
153[[package]]
164[[package]]
154name = "fern"
165name = "fern"
155version = "0.6.0"
166version = "0.6.0"
@@ -271,6 +282,7 @@ name = "helix-core"
271version = "0.1.0"
282version = "0.1.0"
272dependencies = [
283dependencies = [
273 "anyhow",
284 "anyhow",
285+ "etcetera",
274 "helix-syntax",
286 "helix-syntax",
275 "once_cell",
287 "once_cell",
276 "regex",
288 "regex",
@@ -281,7 +293,6 @@ dependencies = [
281 "tree-sitter",
293 "tree-sitter",
282 "unicode-segmentation",
294 "unicode-segmentation",
283 "unicode-width",
295 "unicode-width",
284− "xdg",
285]
296]
286
297
287[[package]]
298[[package]]
@@ -1090,9 +1101,3 @@ name = "winapi-x86_64-pc-windows-gnu"
1090version = "0.4.0"
1101version = "0.4.0"
1091source = "registry+https://github.com/rust-lang/crates.io-index"
1102source = "registry+https://github.com/rust-lang/crates.io-index"
1092checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1103checksum = "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"
22
22
23serde = { version = "1.0", features = ["derive"] }
23serde = { version = "1.0", features = ["derive"] }
24
24
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 {
58
58
59pub fn config_dir() -> std::path::PathBuf {
59pub fn config_dir() -> std::path::PathBuf {
60 // TODO: allow env var override
60 // TODO: allow env var override
61− let xdg_dirs =
61+ use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
62− xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!");
62+ let strategy = choose_base_strategy().expect("Unable to find the config directory!");
63− xdg_dirs.get_config_home()
63+ let mut path = strategy.config_dir();
64+ path.push("helix");
65+ path
64}
66}
65
67
66pub use ropey::{Rope, RopeSlice};
68pub use ropey::{Rope, RopeSlice};