diff --git a/libexec/rbenv b/libexec/rbenv index 87181d7b..ec8adb2a 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -1,6 +1,10 @@ #!/usr/bin/env bash set -e +resolve_link() { + $(type -p greadlink readlink | head -1) $1 +} + abs_dirname() { local cwd="$(pwd)" local path="$1" @@ -8,7 +12,7 @@ abs_dirname() { while [ -n "$path" ]; do cd "${path%/*}" local name="${path##*/}" - path="$(readlink "$name" || true)" + path="$(resolve_link "$name" || true)" done pwd diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 392edf40..3e670372 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -12,6 +12,10 @@ if [ -z "$shell" ]; then shell="$(basename "$SHELL")" fi +resolve_link() { + $(type -p greadlink readlink | head -1) $1 +} + abs_dirname() { local cwd="$(pwd)" local path="$1" @@ -19,7 +23,7 @@ abs_dirname() { while [ -n "$path" ]; do cd "${path%/*}" local name="${path##*/}" - path="$(readlink "$name" || true)" + path="$(resolve_link "$name" || true)" done pwd