]> arthur.barton.de Git - ax-zsh.git/blobdiff - plugins/icalbuddy/icalbuddy.ax-io
Correctly test XDG_CACHE_HOME for writability for "stamp files"
[ax-zsh.git] / plugins / icalbuddy / icalbuddy.ax-io
index 52849bc6c9b2432dcfed7aed5d72088fb0c6613a..41f58aadf67c7ed96780885dc46dd017215d6ba6 100644 (file)
@@ -12,9 +12,9 @@
 
 # Check if reminders have been shown during last 60 minutes, and if so,
 # don't show them now but return.
-[[ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]] || return 0
+[[ -z `find "$XDG_CACHE_HOME/axzsh_last_reminder" -mmin -60 2>/dev/null` ]] || return 0
 
-tmpfile=$(mktemp ${TMPDIR:-/tmp}/icalbuddy.XXXXXX) || return 1
+tmpfile=$(mktemp "$TMPDIR/icalbuddy.XXXXXX") || return 1
 
 if [[ "$LANG" =~ "\.UTF" ]]; then
        bul="•"; bul_imp="!"; sep="»"
@@ -28,14 +28,14 @@ icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
        tasksDueBefore:today 2>/dev/null >>"$tmpfile"
 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
        -nc -npn -iep "title,datetime" \
-       eventsToday+1 2>/dev/null  >>"$tmpfile"
+       eventsToday+1 2>/dev/null >>"$tmpfile"
 
 if [[ -s "$tmpfile" ]]; then
-       echo; cat "$tmpfile"; echo
+       cat "$tmpfile"; echo
 fi
 
 rm -f "$tmpfile"
 unset bul bul_imp sep tmpfile
 
 # Wtite "stamp" file.
-[[ -w ~/ ]] && touch ~/.last_reminder
+[[ -w "$XDG_CACHE_HOME" ]] && touch "$XDG_CACHE_HOME/axzsh_last_reminder"