aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/atuin-common/src/utils.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/atuin-common/src/utils.rs b/crates/atuin-common/src/utils.rs
index 9f7d99c6..bb291ebf 100644
--- a/crates/atuin-common/src/utils.rs
+++ b/crates/atuin-common/src/utils.rs
@@ -65,16 +65,10 @@ pub fn in_git_repo(path: &str) -> Option<PathBuf> {
// I don't want to use ProjectDirs, it puts config in awkward places on
// mac. Data too. Seems to be more intended for GUI apps.
-#[cfg(not(target_os = "windows"))]
pub fn home_dir() -> PathBuf {
- let home = std::env::var("HOME").expect("$HOME not found");
- PathBuf::from(home)
-}
-
-#[cfg(target_os = "windows")]
-pub fn home_dir() -> PathBuf {
- let home = std::env::var("USERPROFILE").expect("%userprofile% not found");
- PathBuf::from(home)
+ directories::BaseDirs::new()
+ .map(|d| d.home_dir().to_path_buf())
+ .expect("could not determine home directory")
}
pub fn config_dir() -> PathBuf {