From b9962f71564ce77cf97772cc100b80f9d77019b1 Mon Sep 17 00:00:00 2001 From: Kimiaki Kuno Date: Thu, 9 Jun 2022 01:54:53 +0900 Subject: [PATCH] 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. --- lib/utils.bash | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils.bash b/lib/utils.bash index dea430b97..1d3a72a7c 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -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"