From 59ba169c4abc99f9fd1977972b56bf954fca4c80 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Mon, 26 Aug 2024 20:39:59 -0400 Subject: [PATCH] relative paths turn into paths starting in `$HOME` APP-MANAGER --- APP-MANAGER | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/APP-MANAGER b/APP-MANAGER index 494156eb1..5263e4366 100755 --- a/APP-MANAGER +++ b/APP-MANAGER @@ -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