diff --git a/lib/utils.bash b/lib/utils.bash index 82884b2..67ad3df 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -48,15 +48,25 @@ install_version() { local install_type="$1" local version="$2" local install_path="$3" + local tool_cmd + tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)" if [ "$install_type" != "version" ]; then fail "asdf-$TOOL_NAME supports release installs only" fi - ( - local tool_cmd - tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)" + # Check if a directory matching ${tool_cmd}_${version}_* exists in the extracted archive in $ASDF_DOWNLOAD_PATH. + # This addresses a change made by Charmbracelet to the way vhs is packaged. + # If there is, update the ASDF_DOWNLOAD_PATH to that directory. + # See https://github.com/charmbracelet/meta/pull/140 for more info. + for dir in "$ASDF_DOWNLOAD_PATH"/"${tool_cmd}_${version}"_*; do + if [ -d "$dir" ]; then + ASDF_DOWNLOAD_PATH="$dir" + break + fi + done + ( mkdir -p "$install_path"/bin cp "$ASDF_DOWNLOAD_PATH"/"$tool_cmd" "$install_path"/bin