If `$look_from` is `.` the resulting file patch will be relative.
# performance reasons, which is only available in zsh-5.0.5-146-g9381bb6.
local last
local parent_dir="$look_from/.."
# performance reasons, which is only available in zsh-5.0.5-146-g9381bb6.
local last
local parent_dir="$look_from/.."
- parent_dir=${parent_dir:A}
- if [[ $parent_dir == $last ]]; then
+ abs_parent_dir=${parent_dir:A}
+ if [[ $abs_parent_dir == $last ]]; then
break
fi
local parent_file="${parent_dir}/${look_for}"
if [[ -f $parent_file ]]; then
break
fi
local parent_file="${parent_dir}/${look_for}"
if [[ -f $parent_file ]]; then
+ if [[ ${parent_file[1,2]} == './' ]]; then
+ echo ${parent_file#./}
+ else
+ echo ${parent_file:A}
+ fi
- if [[ $parent_dir == $look_until ]]; then
+ if [[ $abs_parent_dir == $look_until ]]; then
break
fi
last=$parent_dir
break
fi
last=$parent_dir
$ cd sub/sub2
$ _autoenv_get_file_upwards . file
$ cd sub/sub2
$ _autoenv_get_file_upwards . file
+ ../file
+ $ _autoenv_get_file_upwards $PWD file
*/_autoenv_utils.t/sub/file (glob)
*/_autoenv_utils.t/sub/file (glob)