aports/testing/hstdb/default-histfile-path.patch
2023-03-12 20:03:28 +01:00

33 lines
1,007 B
Diff

Patch-Source: https://github.com/AlexanderThaller/hstdb/pull/55
--
From edd0899c6a53db041972a3411c0973d291b1cf77 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 12 Mar 2023 19:36:37 +0100
Subject: [PATCH] Get default histfile path from HISTFILE env. variable if
exists
This is the standard Zsh variable to define the histfile location.
---
src/opt.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/opt.rs b/src/opt.rs
index af7fb97..91cae47 100644
--- a/src/opt.rs
+++ b/src/opt.rs
@@ -70,9 +70,11 @@ fn default_histdb_sqlite_path() -> PathBuf {
}
fn default_zsh_histfile_path() -> PathBuf {
- let base_dirs = base_directory();
- let home = base_dirs.home_dir();
- home.join(".histfile")
+ std::env::var_os("HISTFILE").map(PathBuf::from).unwrap_or_else(|| {
+ let base_dirs = base_directory();
+ let home = base_dirs.home_dir();
+ home.join(".histfile")
+ })
}
fn default_socket_path() -> PathBuf {