Use XDG data directory for fish import (#851)
* Use XDG data directory for fish import On MacOS, atuin was looking for fish history under "$HOME/Library/Application Support". Now atuin honors XDG_DATA_HOME, if set, and otherwise uses "$HOME/.local/share". * cargo fmt --------- Co-authored-by: Charles Gould <charles@gould.dev>
This commit is contained in:
parent
a72bf07453
commit
04044c4146
1 changed files with 4 additions and 1 deletions
|
@ -19,7 +19,10 @@ pub struct Fish {
|
||||||
/// see https://fishshell.com/docs/current/interactive.html#searchable-command-history
|
/// see https://fishshell.com/docs/current/interactive.html#searchable-command-history
|
||||||
fn default_histpath() -> Result<PathBuf> {
|
fn default_histpath() -> Result<PathBuf> {
|
||||||
let base = BaseDirs::new().ok_or_else(|| eyre!("could not determine data directory"))?;
|
let base = BaseDirs::new().ok_or_else(|| eyre!("could not determine data directory"))?;
|
||||||
let data = base.data_local_dir();
|
let data = std::env::var("XDG_DATA_HOME").map_or_else(
|
||||||
|
|_| base.home_dir().join(".local").join("share"),
|
||||||
|
PathBuf::from,
|
||||||
|
);
|
||||||
|
|
||||||
// fish supports multiple history sessions
|
// fish supports multiple history sessions
|
||||||
// If `fish_history` var is missing, or set to `default`, use `fish` as the session
|
// If `fish_history` var is missing, or set to `default`, use `fish` as the session
|
||||||
|
|
Loading…
Reference in a new issue