Skip to content

Commit 4096451

Browse files
rmnullrmnull
authored andcommitted
exit1 on failure to create NOTES_DIRECTORY
1 parent 7352030 commit 4096451

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

notes

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ notes_dir="${configured_dir:-$HOME/notes}"
1313
escaped_notes_dir="$(printf "$notes_dir" | sed -e 's/[]\/$*.^|[]/\\&/g')"
1414

1515
# Make sure the notes directory actually exists, and create it if it doesn't
16-
if [ ! -d "$notes_dir" ]; then
17-
mkdir -p "$notes_dir"
16+
# if [ ! -d "$notes_dir" ]; then
17+
# mkdir man page says "create the Dir(s) if they donot already exist"
18+
if ! $(mkdir -p "$notes_dir"); then
19+
echo "set \$NOTES_DIRECTORY to a different location" >&2
20+
exit 1
1821
fi
22+
# fi
1923

2024
# If no $EDITOR, look for `editor` (symlink on debian/ubuntu/etc)
2125
if [ -z "$EDITOR" ] && type editor &>/dev/null; then

0 commit comments

Comments
 (0)