Handle directories with spaces.

Refs #8.
This commit is contained in:
Lazarus Lazaridis 2018-03-06 23:39:07 +02:00
parent 01cdb9a8d0
commit c3b0c491ec

View File

@ -83,7 +83,7 @@ USAGE
# Helpful for ~, ., .. paths # Helpful for ~, ., .. paths
function _goto_expand_directory() function _goto_expand_directory()
{ {
printf "$(cd $1 2>/dev/null && pwd)" printf "$(cd "$1" 2>/dev/null && pwd)"
} }
# Lists regstered aliases. # Lists regstered aliases.
@ -116,9 +116,9 @@ function _goto_register_alias()
return return
fi fi
local directory="$(_goto_expand_directory $2)" local directory="$(_goto_expand_directory "$2")"
if [ -z "$directory" ]; then if [ -z "$directory" ]; then
_goto_error "failed to register $1 to $2 - can't cd to directory" _goto_error "failed to register '$1' to '$2' - can't cd to directory"
return return
fi fi