Properly expand RBENV_DIR and ensure it exists

This commit is contained in:
Sam Stephenson 2011-12-25 16:41:15 -05:00
parent b670849ebd
commit 7fbcde8af0

View file

@ -30,7 +30,12 @@ export RBENV_ROOT
if [ -z "${RBENV_DIR}" ]; then
RBENV_DIR="$(pwd)"
else
RBENV_DIR="$(abs_dirname "$RBENV_DIR")"
cd "$RBENV_DIR" 2>/dev/null || {
echo "rbenv: cannot change working directory to \`$RBENV_DIR'"
exit 1
} >&2
RBENV_DIR="$(pwd)"
cd "$OLDPWD"
fi
export RBENV_DIR