Support directory names with white space(s) inside

If you "cd ~/Library/Application Support" or any directory containing a
white space then bash will run in an endless loop.

This is because __shorten_path $PWD $PATH_LENGTH is used instead of
__shorten_path "$PWD" $PATH_LENGTH
Note the use of "" around $PWD in the fixed version.

In case of the bug we have in the __shorten_path function
$1 is set to ~/Library/Application
$2 is set to Support
$3 is set to $PATH_LENGTH

With the fix we now have:
$1 set to ~/Library/Application Support
$2 set to $PATH_LENGTH

Conflicts:

	liquidprompt.bash
This commit is contained in:
Ludovic Rousseau 2012-08-01 14:00:51 +02:00 committed by nojhan
parent fb814125af
commit 3f0522b4a0

View File

@ -729,7 +729,7 @@ __set_bash_prompt()
__USER=$(__user)
__HOST=$(__host_color)
__PERM=$(__permissions_color)
__PWD=$(__shorten_path $PWD $LP_PATH_LENGTH)
__PWD=$(__shorten_path "$PWD" $PATH_LENGTH)
# right of main prompt: space at left
__GIT=$(__sl "$(__git_branch_color)")