|
|
|
@ -28,26 +28,26 @@ if enable -f "${BASH_SOURCE%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev |
|
|
|
else |
|
|
|
[ -z "$RBENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin" |
|
|
|
|
|
|
|
READLINK=$(type -p greadlink readlink | head -1) |
|
|
|
[ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" |
|
|
|
READLINK=$(type -p greadlink readlink | head -1) |
|
|
|
[ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" |
|
|
|
|
|
|
|
resolve_link() { |
|
|
|
$READLINK "$1" |
|
|
|
} |
|
|
|
resolve_link() { |
|
|
|
$READLINK "$1" |
|
|
|
} |
|
|
|
|
|
|
|
abs_dirname() { |
|
|
|
local cwd="$(pwd)" |
|
|
|
local path="$1" |
|
|
|
abs_dirname() { |
|
|
|
local cwd="$PWD" |
|
|
|
local path="$1" |
|
|
|
|
|
|
|
while [ -n "$path" ]; do |
|
|
|
cd "${path%/*}" |
|
|
|
local name="${path##*/}" |
|
|
|
path="$(resolve_link "$name" || true)" |
|
|
|
done |
|
|
|
while [ -n "$path" ]; do |
|
|
|
cd "${path%/*}" |
|
|
|
local name="${path##*/}" |
|
|
|
path="$(resolve_link "$name" || true)" |
|
|
|
done |
|
|
|
|
|
|
|
pwd |
|
|
|
cd "$cwd" |
|
|
|
} |
|
|
|
pwd |
|
|
|
cd "$cwd" |
|
|
|
} |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -z "${RBENV_ROOT}" ]; then |
|
|
|
@ -58,10 +58,10 @@ fi |
|
|
|
export RBENV_ROOT |
|
|
|
|
|
|
|
if [ -z "${RBENV_DIR}" ]; then |
|
|
|
RBENV_DIR="$(pwd)" |
|
|
|
RBENV_DIR="$PWD" |
|
|
|
else |
|
|
|
cd "$RBENV_DIR" 2>/dev/null || abort "cannot change working directory to \`$RBENV_DIR'" |
|
|
|
RBENV_DIR="$(pwd)" |
|
|
|
RBENV_DIR="$PWD" |
|
|
|
cd "$OLDPWD" |
|
|
|
fi |
|
|
|
export RBENV_DIR |
|
|
|
|