wizard: fix handling for $ZDOTDIR and $HOME with special symbols ("%", "$", etc.)

This commit is contained in:
romkatv 2019-09-06 11:30:11 +02:00
commit ef6f90f598
2 changed files with 11 additions and 11 deletions

View file

@ -1346,14 +1346,14 @@ function generate_config() {
function write_zshrc() {
if [[ -e $__p9k_zshrc ]]; then
local lines=(${(f)"$(<$__p9k_zshrc)"})
local f1=$__p9k_cfg_path
local f2=$__p9k_cfg_path_u
local f3=${__p9k_cfg_path_u/#\~\//\$HOME\/}
local f4=${__p9k_cfg_path_u/#\~\//\"\$HOME\"\/}
local f5="'$f1'"
local f6="\"$f1\""
local f7="\"$f3\""
if [[ -n ${(@M)lines:#(#b)[^#]#([^[:IDENT:]]|)source[[:space:]]##($f1|$f2|$f3|$f4|$f5|$f6|$f7)*} ]]; then
local f0=$__p9k_cfg_path
local f1=${(q)f0}
local f2=${(q-)f0}
local f3=${(q+)f0}
local f4=${(qq)f0}
local f5=${(qqq)f0}
local g1=${${(q)__p9k_cfg_path}/#(#b)${(q)HOME}\//'~/'}
if [[ -n ${(@M)lines:#(#b)[^#]#([^[:IDENT:]]|)source[[:space:]]##($f1|$f2|$f3|$f4|$f5|$g1)(|[[:space:]]*|'#'*)} ]]; then
flowing +c No changes have been made to %4F$__p9k_zshrc_u%f because it already sources %2F$__p9k_cfg_path_u%f.
return
fi