[PATCH 2/4] dim: Move last-path file to XDG_CACHE_HOME

Maxime Ripard maxime at cerno.tech
Thu Jan 13 08:43:50 UTC 2022


XDG_CACHE_HOME is meant to hold "user-specific, non-essential data"
which seems like a good fit and avoids bloating ~.

Signed-off-by: Maxime Ripard <maxime at cerno.tech>
---
 bash_completion | 4 +++-
 dim             | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/bash_completion b/bash_completion
index 764993ba7472..aea1947f4be8 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1,6 +1,8 @@
 #! /bin/bash
 
-dim_last_path_file=~/.dim-last-path
+DIM_CACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/dim
+
+dim_last_path_file=$DIM_CACHE_DIR/last-path
 
 dim ()
 {
diff --git a/dim b/dim
index 865b2cb161b7..f098b14b4da1 100755
--- a/dim
+++ b/dim
@@ -35,6 +35,8 @@ set -e
 # environment or configuration file. See dimrc.sample for an example.
 #
 
+DIM_CACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/dim
+
 # dim configuration file
 DIM_CONFIG=${DIM_CONFIG:-$HOME/.dimrc}
 if [ -r $DIM_CONFIG ]; then
@@ -102,7 +104,7 @@ dim_pull_request_recipients=(
 # integration configuration
 dim_integration_config=nightly.conf
 
-dim_last_path_file=~/.dim-last-path
+dim_last_path_file=$DIM_CACHE_DIR/last-path
 
 dim_extract_tags_marker="# *** extracted tags ***"
 
-- 
2.34.1



More information about the dim-tools mailing list