feat: Added checks to prevent entire home directory and config directory from being tracked

This commit is contained in:
Daniel Fichtinger 2024-12-04 15:37:53 -05:00
parent dfb7ea8986
commit cfa998c1c9

View file

@ -25,7 +25,12 @@ for arg in "$@"; do
fi fi
# get its absolute path # get its absolute path
abs=$(realpath "$arg") abs=$(realpath "$arg")
# check if it's inside home dir # Don't allow direct homedir or config dir
if [[ "$abs" == "$HOME" || "$abs" == "$HOME/.config" ]]; then
echo "$AYM Path cannot be home directory or config directory."
exit 1
fi
# check if /inside/ home dir
if [[ "$abs" == "$HOME"* ]]; then if [[ "$abs" == "$HOME"* ]]; then
# convert to path relative to ~ # convert to path relative to ~
rel=${abs#"$HOME/"} rel=${abs#"$HOME/"}