fix: get invalid ASDF_DATA_DIR when exec asdf shims by non-shell (#1154)

* fix: get invalid ASDF_DATA_DIR when exec asdf shims by non-shell

asdf_data_dir function inits ASDF_DATA_DIR with HOME when value is empty.
HOME may replace to empty string when asdf shims called by non-shell program.
this makes invalid value of ASDF_DATA_DIR.
This commit is contained in:
Kimiaki Kuno 2022-06-09 01:54:53 +09:00 committed by GitHub
parent 92d005dacd
commit b9962f7156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,8 +41,10 @@ asdf_data_dir() {
if [ -n "${ASDF_DATA_DIR}" ]; then
data_dir="${ASDF_DATA_DIR}"
else
elif [ -n "$HOME" ]; then
data_dir="$HOME/.asdf"
else
data_dir=$(asdf_dir)
fi
printf "%s\\n" "$data_dir"