Skip to content

Commit

Permalink
if prefix is provided, get its fullpath using cd and pwd
Browse files Browse the repository at this point in the history
  • Loading branch information
tomeichlersmith committed Sep 5, 2023
1 parent f4b7f76 commit c6c38c3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ while [ "$#" -gt 0 ]; do
;;
-p | --prefix)
if [ -n "$2" ]; then
prefix="$2"
[ -d "$2" ] || mkdir -p "$2"
prefix="$(cd "$2" && pwd -P)"
shift
shift
fi
Expand All @@ -119,11 +120,9 @@ if [ -z "${prefix}" ]; then
fi
fi

if [ ! -d "${prefix}" ]; then
if ! mkdir -p "${prefix}"; then
_denv_error "Cannot write into ${prefix}, permission denied"
exit 1
fi
if [ ! -w "${prefix}" ]; then
_denv_error "Cannot write into ${prefix}, permission denied"
exit 1
fi

completion_dest_path="${prefix}/share/bash-completion/completions/"
Expand Down

0 comments on commit c6c38c3

Please sign in to comment.