From 2b6dae25c6b7cb8d698a9030cae5b3bffec52719 Mon Sep 17 00:00:00 2001 From: ryangreenup Date: Fri, 24 Jul 2020 01:47:39 +1000 Subject: [PATCH] Moved Config File to ~/.config/cadmus/config.json #11 #2 (also fixed double enter bug in generator) --- bin/cadmus | 3 ++- bin/makeConfig.bash | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/cadmus b/bin/cadmus index 1c136ca..7b6062a 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -3,7 +3,7 @@ readonly script_name=$(basename "${0}") script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) readonly script_dir=$(realpath "${script_dir}""/""${script_name}" | xargs dirname) -readonly CONFIG=$(realpath "${script_dir}/../config.json") # one directory above +readonly CONFIG="$HOME/.config/cadmus/config.json" # one directory above ## readonly SERVER_DIR="/srv/www/html/MD" ## readonly RECOLL_CONFIG_DIR="$HOME/.cadmus" ## readonly MKDOCS_YML="$HOME/Notes/mkdocs.yml" ## This may be above the notes directory, the @@ -127,6 +127,7 @@ checkConfig () { if [[ "${choice}" == "y" ]]; then config_json=$("${script_dir}/makeConfig.bash") if [[ "${config_json}" != "" ]]; then + [[ -d "$(dirname "${CONFIG}")" ]] || mkdir -p "$(dirname "${CONFIG}")" echo "${config_json}" > "${CONFIG}" echo -e "This is the Config:\n" highlight "${CONFIG}" diff --git a/bin/makeConfig.bash b/bin/makeConfig.bash index 9a2cf58..209bdc4 100755 --- a/bin/makeConfig.bash +++ b/bin/makeConfig.bash @@ -96,7 +96,6 @@ AskValues () { echoerr "\t (This directory should contain index.md or home.md)" read -e NOTES_DIR NOTES_DIR="$(echo "${NOTES_DIR/\~/$HOME}")" - read -d '' -s -n1 choice # NOTES_DIR="$(cd /; sk --height 40% -i -c 'fd {}' )" [[ -d "${NOTES_DIR}" ]] || echoerr -e "\n \e[3m\e[1m \e[1;31m ⚠ WARNING: \e[0m No Such Directory!"