diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-08-21 19:40:34 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-08-21 19:40:34 +0000 |
commit | f20b66dd24e490fbfedac7787760b4732daa8119 (patch) | |
tree | 6863bb3a2e2fe367107f90a9eca7f2f6dcfd665f /Completion/compinstall | |
parent | 2f0bb9589c764ee0a8be75a43937907591686354 (diff) | |
download | zsh-f20b66dd24e490fbfedac7787760b4732daa8119.tar.gz zsh-f20b66dd24e490fbfedac7787760b4732daa8119.tar.xz zsh-f20b66dd24e490fbfedac7787760b4732daa8119.zip |
zsh-users/10634: try to fix relative paths of completion configuration file
Diffstat (limited to 'Completion/compinstall')
-rw-r--r-- | Completion/compinstall | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Completion/compinstall b/Completion/compinstall index dc030e7a9..802860410 100644 --- a/Completion/compinstall +++ b/Completion/compinstall @@ -109,15 +109,23 @@ if [[ -n $basic ]]; then return fi - local newifile=$ifile if [[ $foundold = true ]]; then - print "I have found completion definitions in $ifile. + if [[ $newifile != [~/]* ]]; then + newifile=${ZDOTDIR:-~}/$newifile + print "[Existing completion definition file is not absolute path: +updating to $newifile]" + fi + print "I have found completion definitions in $newifile. If you want me to read these, just hit return. Otherwise, edit the file name to look for definitions somewhere else, or delete the whole line in order not to use existing definitions." vared -ch -p 'file> ' newifile - [[ -z $newifile ]] && foundold=false + if [[ -n $newifile && $newifile != [/~]* ]]; then + newifile=$PWD/$newifile + print "[Not absolute path: updating to $newifile]" + fi + [[ -z $newifile || ! -f $newfile ]] && foundold=false else print "I haven't found any existing completion definitions. If you have some already defined by compinstall, edit the name of the @@ -126,6 +134,10 @@ are exactly the form in which compinstall inserted them. If you leave the line as it is, or empty, I won't search." while true; do vared -ch -p 'file> ' newifile || break + if [[ -n $newifile && $newifile != [/~]* ]]; then + newifile=$PWD/$newifile + print "[Not absolute path: updating to $newifile]" + fi if [[ -n $newifile && $ifile != $newifile ]]; then if __ci_test_ifile $newifile; then foundold=true @@ -138,7 +150,7 @@ leave the line blank to ignore it." fi done fi -ifile=$newifile +ifile=${~newifile} if [[ $foundold = true ]]; then sed -n "/^[ ]*$startline/,/^[ ]*$endline/p" $ifile | @@ -1926,6 +1938,10 @@ if [[ -z $ifile || -d $ifile ]] || print "Enter file to save in (~ will be expanded), or return to abort:" ifile= vared -ch -p 'file> ' ifile + if [[ $ifile != [/~]* ]]; then + ifile=$PWD/$ifile + print "[Not absolute path; updating to $ifile]" + fi ifile=${~ifile} fi |