Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/virtualenv/activation/bash/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ deactivate () {
# unset irrelevant variables
deactivate nondestructive

VIRTUAL_ENV=__VIRTUAL_ENV__
if [ ! -d __VIRTUAL_ENV__ ]; then
echo "Virtual environment directory __VIRTUAL_ENV__ does not exist!" >&2
CURRENT_PATH=$(realpath "${0}")
CURRENT_DIR=$(dirname "${CURRENT_PATH}")
VIRTUAL_ENV="$(realpath "${CURRENT_DIR}/../")"
else
VIRTUAL_ENV=__VIRTUAL_ENV__
fi

if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
fi
Expand Down