summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRashil Gandhi <46838874+rashil2000@users.noreply.github.com>2021-12-12 00:49:43 +0530
committerGitHub <noreply@github.com>2021-12-11 14:19:43 -0500
commit87156fb8710335ba8f933f6372fc4b24e07a2e07 (patch)
treed527a8031a1b7b03c118e8aa02f2c74756d9e5af
parentda083bba2a093ea2ff4558e59c48bd6672b75480 (diff)
Store history file in data_local_dir for Windows (#847)
* Store history file in data_local_dir * Be specific
-rw-r--r--src/features/navigate.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/features/navigate.rs b/src/features/navigate.rs
index 60182907..db582dd3 100644
--- a/src/features/navigate.rs
+++ b/src/features/navigate.rs
@@ -90,9 +90,11 @@ pub fn copy_less_hist_file_and_append_navigate_regex(config: &Config) -> std::io
#[cfg(target_os = "windows")]
fn get_delta_less_hist_file() -> std::io::Result<PathBuf> {
- let mut path = dirs_next::home_dir()
- .ok_or_else(|| Error::new(ErrorKind::NotFound, "Can't determine home dir"))?;
- path.push(".delta.lesshst");
+ let mut path = dirs_next::data_local_dir()
+ .ok_or_else(|| Error::new(ErrorKind::NotFound, "Can't find AppData\\Local folder"))?;
+ path.push("delta");
+ std::fs::create_dir_all(&path)?;
+ path.push("delta.lesshst");
Ok(path)
}