Use path comparison not string comparison for paths

This will solve part of issue #4255 where WORKON_HOME is defined with a
trailing slash or not normalised in some way, as well as instances
where symlinks are used, and any other instances where constructed
paths don't exactly match even though they go to the same file.
This commit is contained in:
Dom Sekotill 2016-11-24 15:10:29 +00:00
parent cc9695b081
commit 31afbc760e

View File

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