Make the config dir locator work on Windows.

pull/11/head
Blaž Hrastnik 4 years ago
parent 37d32e2933
commit 1f2d87cb95

19
Cargo.lock generated

@ -150,6 +150,17 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "etcetera"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "016b04fd1e94fb833d432634245c9bb61cf1c7409668a0e7d4c3ab00c5172dec"
dependencies = [
"cfg-if",
"dirs-next",
"thiserror",
]
[[package]] [[package]]
name = "fern" name = "fern"
version = "0.6.0" version = "0.6.0"
@ -271,6 +282,7 @@ name = "helix-core"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"etcetera",
"helix-syntax", "helix-syntax",
"once_cell", "once_cell",
"regex", "regex",
@ -281,7 +293,6 @@ dependencies = [
"tree-sitter", "tree-sitter",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
"xdg",
] ]
[[package]] [[package]]
@ -1090,9 +1101,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "xdg"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"

@ -22,4 +22,4 @@ regex = "1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
xdg = "2.0" etcetera = "0.3"

@ -58,9 +58,11 @@ pub fn runtime_dir() -> std::path::PathBuf {
pub fn config_dir() -> std::path::PathBuf { pub fn config_dir() -> std::path::PathBuf {
// TODO: allow env var override // TODO: allow env var override
let xdg_dirs = use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};
xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!"); let strategy = choose_base_strategy().expect("Unable to find the config directory!");
xdg_dirs.get_config_home() let mut path = strategy.config_dir();
path.push("helix");
path
} }
pub use ropey::{Rope, RopeSlice}; pub use ropey::{Rope, RopeSlice};

Loading…
Cancel
Save