From 71ca9626f0d4e494247490934f3e6b01d3b20504 Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Mon, 17 Feb 2020 21:10:17 +0200 Subject: [PATCH] Fix zinit (fixes #323) --- src/steps/zsh.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/steps/zsh.rs b/src/steps/zsh.rs index 23d1b4cf..0e59ea0a 100644 --- a/src/steps/zsh.rs +++ b/src/steps/zsh.rs @@ -1,3 +1,4 @@ +use crate::error::SkipStep; use crate::executor::RunType; use crate::terminal::print_separator; use crate::utils::{require, PathExt}; @@ -73,10 +74,21 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { .unwrap_or_else(|_| base_dirs.home_dir().join(".zinit")) .exists(); - print_separator("zinit"); + let zplug_exists = env::var("ZPLUG_HOME") + .map(PathBuf::from) + .unwrap_or_else(|_| base_dirs.home_dir().join("zplug")) + .exists(); // Check whether this is a pre- or post- renaming installation - let zcommand = if zinit_exists { "zinit" } else { "zplugin" }; + let zcommand = if zinit_exists { + "zinit" + } else if zplug_exists { + "zplugin" + } else { + return Err(SkipStep.into()); + }; + + print_separator("zinit"); let cmd = format!( "source {} && {} self-update && {} update --all",