From 34b61354151dd332f3853c7bc58a58bc1e3933cd Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 1 Mar 2015 20:46:10 -0500 Subject: [PATCH] add support for $XDG_CONFIG_HOME config file/actions location --- todo.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/todo.sh b/todo.sh index 2c0169d..10bf9cc 100755 --- a/todo.sh +++ b/todo.sh @@ -656,6 +656,15 @@ export SENTENCE_DELIMITERS=',.:;' fi } +[ -e "$TODOTXT_CFG_FILE" ] || { + CFG_FILE_ALT="${XDG_CONFIG_HOME:-$HOME/.config}/todo/config" + + if [ -e "$CFG_FILE_ALT" ] + then + TODOTXT_CFG_FILE="$CFG_FILE_ALT" + fi +} + [ -e "$TODOTXT_CFG_FILE" ] || { CFG_FILE_ALT=$(dirname "$0")"/todo.cfg" @@ -690,6 +699,15 @@ fi fi } +[ -d "$TODO_ACTIONS_DIR" ] || { + TODO_ACTIONS_DIR_ALT="${XDG_CONFIG_HOME:-$HOME/.config}/todo/actions" + + if [ -d "$TODO_ACTIONS_DIR_ALT" ] + then + TODO_ACTIONS_DIR="$TODO_ACTIONS_DIR_ALT" + fi +} + # === SANITY CHECKS (thanks Karl!) === [ -r "$TODOTXT_CFG_FILE" ] || dieWithHelp "$1" "Fatal Error: Cannot read configuration file $TODOTXT_CFG_FILE"