Create md file if it doesn't exist yet.

This commit is contained in:
Chris McCormick 2025-12-30 20:41:27 +08:00
parent 22796b6c91
commit 409351aa70

9
kbtd
View file

@ -61,6 +61,15 @@ fi
# --- Path Resolution ---
# Create file if it doesn't exist (but only if directory exists)
if [[ ! -f "$FILE_PATH" ]]; then
DIR_PATH=$(dirname "$FILE_PATH")
if [[ ! -d "$DIR_PATH" ]]; then
error_exit "Directory does not exist: $DIR_PATH"
fi
touch "$FILE_PATH"
fi
# Resolve absolute path
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ABS_PATH=$(realpath "$FILE_PATH")