mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Fall back to $PWD if a local version file can't be found in $RBENV_DIR
This commit is contained in:
parent
c3fe192243
commit
6c1fb9ffd0
1 changed files with 13 additions and 8 deletions
|
@ -2,7 +2,8 @@
|
||||||
set -e
|
set -e
|
||||||
[ -n "$RBENV_DEBUG" ] && set -x
|
[ -n "$RBENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
root="$RBENV_DIR"
|
find_local_version_file() {
|
||||||
|
local root="$1"
|
||||||
while [ -n "$root" ]; do
|
while [ -n "$root" ]; do
|
||||||
if [ -e "${root}/.rbenv-version" ]; then
|
if [ -e "${root}/.rbenv-version" ]; then
|
||||||
echo "${root}/.rbenv-version"
|
echo "${root}/.rbenv-version"
|
||||||
|
@ -10,6 +11,10 @@ while [ -n "$root" ]; do
|
||||||
fi
|
fi
|
||||||
root="${root%/*}"
|
root="${root%/*}"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
find_local_version_file "$RBENV_DIR"
|
||||||
|
[ "$RBENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
|
||||||
|
|
||||||
global_version_file="${RBENV_ROOT}/version"
|
global_version_file="${RBENV_ROOT}/version"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue