diff --git a/agenda b/agenda index f89dd61..0ab3fa5 100755 --- a/agenda +++ b/agenda @@ -24,11 +24,15 @@ if [[ $1 == '' ]]; then exit 1 fi -root_dir=$(dirname $1)/.daisy/$(basename $1) -today_sym=$1 +dir=$(realpath -s "$1") +parent_dir=$(dirname "$dir") +name=$(basename "$dir") +root_dir="$parent_dir/.daisy/$name" +today_sym="$dir" # Present day read year month day < <(date "+%Y %m %d") +today="$root_dir/$year/$month/$day" set -e @@ -50,7 +54,7 @@ trap errorFn ERR test -e "$root_dir" && find "$root_dir" -maxdepth 3 -type d -empty -delete # Now we can set up today's directory -mkdir -p "$root_dir/$year/$month/$day" -ln -sf "$root_dir/$year/$month/$day" "$today_sym" -ln -s "$root_dir" "$today_sym/.tree" +mkdir -p "$today" +ln -snf "$today" "$today_sym" +ln -snf "$root_dir" "$dir/.tree" exitcode=$? diff --git a/editx b/editx index 685a977..1a7420f 100755 --- a/editx +++ b/editx @@ -20,7 +20,7 @@ fi touch "$1" chmod +x "$1" -daisy_editor "$1" +daisy editor "$1" if [[ ! -s "$1" && $existed -eq 0 ]]; then rm -f "$1"