bugfix for issue #4255, where cd can get stuck if virtualenvwrapper plugin is used in combination with WORKON_HOME and a trailing slash

This commit is contained in:
Dominique Barton 2015-08-18 08:40:19 +02:00
parent 192de6bcff
commit cf8bb2983c

View File

@ -63,7 +63,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
fi fi
if [[ "$ENV_NAME" != "" ]]; then if [[ "$ENV_NAME" != "" ]]; then
# Activate the environment only if it is not already active # Activate the environment only if it is not already active
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then if [[ "$VIRTUAL_ENV" != "${WORKON_HOME%/}/$ENV_NAME" ]]; then
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME" workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
elif [[ -e "$ENV_NAME/bin/activate" ]]; then elif [[ -e "$ENV_NAME/bin/activate" ]]; then