# HG changeset patch # User Sean E. Russell # Date 1698346989 18000 # Thu Oct 26 14:03:09 2023 -0500 # Node ID 23eecfb7135a9606975a7610772e3a7eaeaa4e2c # Parent 6f5e8c0a419991247a4a54533802bd0cd94d4591 Better cache dir initialization in script diff --git a/synctodo b/synctodo --- a/synctodo +++ b/synctodo @@ -10,6 +10,14 @@ # - zsh, because it's the best shell STTDIR=$XDG_CACHE_HOME/synctodo +if [[ -z $XDG_CACHE_HOME ]]; then + if [[ -d ${HOME}/.cache ]]; then + STTDIR=${HOME}/.cache/synctodo + else + STTDIR=${HOME}/.synctodo + fi +fi +test \! -d "$STTDIR" && mkdir -p "$STTDIR" # There really should be standards for crap like this if [[ -n $(command -v mktemp) ]]; then