diff options
| author | János Illés <ijanos@gmail.com> | 2023-04-08 11:53:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-08 10:53:32 +0100 |
| commit | 04044c414647c8ce9c9be92e23d5a5247250d294 (patch) | |
| tree | 20c3c7d5558f72a0467ce6b4c4786fa61bc17cd7 /atuin-client/src/import/fish.rs | |
| parent | Fix --delete description (#853) (diff) | |
| download | atuin-04044c414647c8ce9c9be92e23d5a5247250d294.zip | |
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>
Diffstat (limited to 'atuin-client/src/import/fish.rs')
| -rw-r--r-- | atuin-client/src/import/fish.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/atuin-client/src/import/fish.rs b/atuin-client/src/import/fish.rs index 7186537e..e54ca730 100644 --- a/atuin-client/src/import/fish.rs +++ b/atuin-client/src/import/fish.rs @@ -19,7 +19,10 @@ pub struct Fish { /// see https://fishshell.com/docs/current/interactive.html#searchable-command-history fn default_histpath() -> Result<PathBuf> { 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 // If `fish_history` var is missing, or set to `default`, use `fish` as the session |
