Update java home on zsh using buildin function, based on https://github.com/halcyon/asdf-java/pull/136, with review comment of @halcyon

This commit is contained in:
Wessel van Norel 2021-04-06 17:43:02 +02:00 committed by Scott McLeod
parent 7e02348393
commit 38ca9d0bcc

View File

@ -1,15 +1,9 @@
function absolute_dir_path {
local absolute_path
absolute_path="$( cd -P "$( dirname "$1" )" && pwd )"
echo "$absolute_path"
}
asdf_update_java_home() {
local java_path
java_path="$(asdf which java)"
if [[ -n "${java_path}" ]]; then
export JAVA_HOME
JAVA_HOME="$(dirname "$(absolute_dir_path "${java_path}")")"
JAVA_HOME="$(dirname "$(dirname "${java_path:A}")")"
fi
}