Skip to content

Commit

Permalink
relative paths turn into paths starting in $HOME APP-MANAGER
Browse files Browse the repository at this point in the history
  • Loading branch information
Samueru-sama authored Aug 27, 2024
1 parent 92bdc04 commit 59ba169
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions APP-MANAGER
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,18 @@ function _appman_check() {
echo " and then edit the "$APPMANCONFIG"/appman-config file."
echo "$DIVIDING_LINE"
read -r -ep " Write the path or just press enter to use default: " location
location="$(echo "$location" | sed 's/[ \t]/-/g' 2>/dev/null)"
location="$(echo "$location" | sed 's/[ \t]/-/g; s|^\./||' 2>/dev/null)"
[ -z "$location" ] && location="$HOME/Applications"
if ! echo "$location" | grep "^/" >/dev/null 2>&1; then
location="$HOME/$location"
fi
if [ "$location" = "$BINDIR" ]; then
echo "$DIVIDING_LINE"
echo " 💀 ERROR, you can't install applications in \"$BINDIR\""
echo " $BINDIR is normally used for executables, Please choose a different path and retry!"
echo "$DIVIDING_LINE"
exit 1
elif ! echo "$location" | grep "^/" >/dev/null 2>&1; then
echo " 💀 ERROR: You need to specify a full path and not a relative path"
exit 1
fi
if ! mkdir -p "$location" >/dev/null 2>&1; then
elif ! mkdir -p "$location" 2>/dev/null || [ ! -w "$location" ]; then
echo " 💀 ERROR: You don't have write access to $location or it is invalid"
exit 1
fi
Expand Down

0 comments on commit 59ba169

Please sign in to comment.