_autoenv_source() {
local env_file=$1
_autoenv_event=$2
- local _autoenv_envfile_dir=$3
+ local _autoenv_envfile_dir=${3:-${1:A:h}}
_autoenv_from_dir=$_autoenv_chpwd_prev_dir
_autoenv_to_dir=$PWD
_autoenv_stack_entered_add $env_file
# Source the enter env file.
- _autoenv_source $env_file enter $PWD
+ _autoenv_source $env_file enter
_autoenv_chpwd_prev_dir=$PWD
}