Fix "no such file or directory" error

before initial check for latest version. Not all versions of Zsh or all
OSs are affected. Error seen with Zsh 5.6.2 running on FreeBSD is:

    _zimfw_version_check:10: no such file or directory: /path/to/.latest_version
This commit is contained in:
Eric Nielsen 2020-01-22 12:48:19 -05:00
parent bebbfcec9e
commit cbf142a988
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
4 changed files with 15 additions and 10 deletions

View File

@ -7,7 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
_No unreleased changes._
### Fixed
- "no such file or directory" error before initial check for latest version.
## [1.1.0] - 2020-01-20

View File

@ -8,9 +8,11 @@ _zimfw_version_check() {
command sed 's?^.*/v??' | command sort -n -t. -k1,1 -k2,2 -k3,3 | \
command tail -n1 >! ${ztarget} &!
fi
if [[ -f ${ztarget} ]]; then
local -r zlatest_version=$(<${ztarget})
if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then
print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f"$'\n'
fi
fi
fi
}

View File

@ -6,7 +6,7 @@ class Zim
@home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2"
@startup_files_glob = ".z(shenv|profile|shrc|login|logout)"
@version = "1.1.0"
@version = "1.1.1-SNAPSHOT"
@ellipsis = " ..."
@okay = "%F{green})%f "
@error = "x "

View File

@ -246,11 +246,13 @@ _zimfw_version_check() {
command sed 's?^.*/v??' | command sort -n -t. -k1,1 -k2,2 -k3,3 | \
command tail -n1 >! ${ztarget} &!
fi
if [[ -f ${ztarget} ]]; then
local -r zlatest_version=$(<${ztarget})
if [[ -n ${zlatest_version} && ${_zversion} != ${zlatest_version} ]]; then
print -u2 -PR "%F{yellow}Latest zimfw version is %B${zlatest_version}%b. You're using version %B${_zversion}%b. Run %Bzimfw upgrade%b to upgrade.%f"$'\n'
fi
fi
fi
}
_zimfw_clean_compiled() {
@ -276,7 +278,7 @@ _zimfw_compile() {
}
_zimfw_info() {
print -R 'zimfw version: '${_zversion}' (previous commit is 64f36fe)'
print -R 'zimfw version: '${_zversion}' (previous commit is bebbfce)'
print -R 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
@ -320,7 +322,7 @@ _zimfw_upgrade() {
}
zimfw() {
local -r _zversion='1.1.0'
local -r _zversion='1.1.1-SNAPSHOT'
local -r zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: