aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-09-06 12:30:11 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-09-06 12:30:11 +0300
commitef6f90f598dcce54b9a96f2aae317a20cab541e9 (patch)
treef30e0f3e45b90e99b1e65ea93586eb04d4baa8fa
parent072f7be8ff2e3210484956877f066ccd7b157c8c (diff)
wizard: fix handling for $ZDOTDIR and $HOME with special symbols ("%", "$", etc.)
-rw-r--r--internal/configure.zsh6
-rwxr-xr-xinternal/wizard.zsh16
2 files changed, 11 insertions, 11 deletions
diff --git a/internal/configure.zsh b/internal/configure.zsh
index f8483d75..ae24be34 100644
--- a/internal/configure.zsh
+++ b/internal/configure.zsh
@@ -1,13 +1,13 @@
typeset -gr __p9k_wizard_columns=55
typeset -gr __p9k_wizard_lines=21
-typeset -gr __p9k_zd=${${ZDOTDIR:-$HOME}:A}
-typeset -gr __p9k_zd_u=${${${(q-)__p9k_zd}/#(#b)$HOME(|\/*)/'~'$match[1]}//\%/%%}
+typeset -gr __p9k_zd=${ZDOTDIR:-$HOME}
+typeset -gr __p9k_zd_u=${${${(q)__p9k_zd}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
typeset -gr __p9k_cfg_basename=.p10k.zsh
typeset -gr __p9k_cfg_path=$__p9k_zd/$__p9k_cfg_basename
typeset -gr __p9k_cfg_path_u=$__p9k_zd_u/$__p9k_cfg_basename
typeset -gr __p9k_zshrc=$__p9k_zd/.zshrc
typeset -gr __p9k_zshrc_u=$__p9k_zd_u/.zshrc
-typeset -gr __p9k_root_dir_u=${${${(q-)__p9k_root_dir}/#(#b)$HOME(|\/*)/'~'$match[1]}//\%/%%}
+typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%}
function _p9k_can_configure() {
emulate -L zsh
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 56733098..893fa243 100755
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -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