diff options
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/Cargo.toml | 2 | ||||
-rw-r--r-- | helix-core/src/lib.rs | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index d95c0f47..4b1566d7 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -21,3 +21,5 @@ once_cell = "1.4" regex = "1" serde = { version = "1.0", features = ["derive"] } + +xdg = "2.0" diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index b3ce3c47..dda9863b 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -44,6 +44,13 @@ pub(crate) fn find_first_non_whitespace_char(text: RopeSlice, line_num: usize) - None } +pub fn config_dir() -> std::path::PathBuf { + // TODO: allow env var override + let xdg_dirs = + xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!"); + xdg_dirs.get_config_home() +} + pub use ropey::{Rope, RopeSlice}; pub use tendril::StrTendril as Tendril; |