Fix a possible panic with ZSH zinit

This commit is contained in:
Roey Darwish Dror
2020-02-16 15:59:10 +02:00
parent 3e055580ab
commit 17103f872f

View File

@@ -68,12 +68,15 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let zsh = require("zsh")?;
let zshrc = zshrc(base_dirs).require()?;
env::var("ZPFX").map(PathBuf::from).unwrap().require()?;
let zinit_exists = env::var("ZPFX")
.map(PathBuf::from)
.unwrap_or_else(|_| base_dirs.home_dir().join(".zinit"))
.exists();
print_separator("zinit");
// Check whether this is a pre- or post- renaming installation
let zcommand = if Path::new(&base_dirs.home_dir().join(".zinit")).exists() {
let zcommand = if zinit_exists {
"zinit"
} else {
"zplugin"