diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-08-30 14:40:12 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-08-30 14:40:12 +0300 |
commit | a3727dcaefbfba04484ba0f979c62d070850eeed (patch) | |
tree | e79ac980c88979ddf9f8953967e6582632751a37 /internal/configure.zsh | |
parent | c1db3926feaf03bf36f205b2e31a4498641795ba (diff) |
wizard: don't refuse to start if ZDOTDIR is not writable; see #987
Diffstat (limited to 'internal/configure.zsh')
-rw-r--r-- | internal/configure.zsh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/configure.zsh b/internal/configure.zsh index 63a73978..4fb7cb6e 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -21,10 +21,20 @@ function _p9k_can_configure() { [[ -o multibyte ]] || { $0_error "multibyte option is not set"; return 1 } [[ -e $__p9k_zd ]] || { $0_error "$__p9k_zd_u does not exist"; return 1 } [[ -d $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not a directory"; return 1 } - [[ -w $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not writable"; return 1 } [[ ! -d $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a directory"; return 1 } [[ ! -d $__p9k_zshrc ]] || { $0_error "$__p9k_zshrc_u is a directory"; return 1 } + local dir=${__p9k_cfg_path:h} + while [[ ! -e $dir && $dir != ${dir:h} ]]; do dir=${dir:h}; done + if [[ ! -d $dir ]]; then + $0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is not a directory" + return 1 + fi + if [[ ! -w $dir ]]; then + $0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is readonly" + return 1 + fi + [[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a special file" return 1 |