feat: Added checks to prevent entire home directory and config directory from being tracked
This commit is contained in:
parent
dfb7ea8986
commit
cfa998c1c9
1 changed files with 6 additions and 1 deletions
|
@ -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/"}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue