From 587833bb4e6855f61385d8fa75c6746069f344ec Mon Sep 17 00:00:00 2001 From: Keith Date: Fri, 6 Aug 2021 10:14:25 -0400 Subject: [PATCH] Default to user writable directory in config (#148) When a user installs from a package manager (MacPorts, Homebrew, `yum`, etc.), the `todo.sh` script is installed into a restricted folder. This means that the result of `$(basename "$0")` is a directory where the user cannot write without elevated permissions. This generates additional noise when the user first runs `todo.sh -h`. An alternative is to default to the user's personal directory which is known to exist and will be writable by the user. --- todo.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.cfg b/todo.cfg index 4d6adc8..0ab7d9b 100644 --- a/todo.cfg +++ b/todo.cfg @@ -2,7 +2,7 @@ # Your todo.txt directory (this should be an absolute path) #export TODO_DIR="/Users/gina/Documents/todo" -export TODO_DIR=$(dirname "$0") +export TODO_DIR=${HOME:-$USERPROFILE} # Your todo/done/report.txt locations export TODO_FILE="$TODO_DIR/todo.txt"