[PATCH 3/4] dim: Move timestamp file to XDG_CACHE_HOME

Maxime Ripard maxime at cerno.tech
Thu Jan 13 08:43:51 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>
---
 dim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index f098b14b4da1..a5aa182b2e24 100755
--- a/dim
+++ b/dim
@@ -408,12 +408,13 @@ function check_for_updates
 {
 	local stamp stampfile
 
-	stampfile=$HOME/.dim-update-check-timestamp
+	stampfile=$DIM_CACHE_DIR/update-check-timestamp
 
 	# daily check for updates based on file timestamp
 	stamp=$(stat --printf=%Y $stampfile 2>/dev/null || echo -n 0)
 	if [[ $((stamp + 24*60*60)) -lt $(date +%s) ]]; then
 		dim_uptodate || true
+		mkdir -p $(dirname $stampfile)
 		touch $stampfile
 	fi
 }
-- 
2.34.1



More information about the dim-tools mailing list