From e1bdee7045d85c6a3291c3f8ca97f860fc053858 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 20 Sep 2022 14:10:52 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=8E=A8=20Exit=20the=20program=20?= =?UTF-8?q?if=20there=20is=20an=20existing=20esp=20toolchain=20installed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rust_toolchain.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rust_toolchain.rs b/src/rust_toolchain.rs index 3d16f5d..bc473ca 100644 --- a/src/rust_toolchain.rs +++ b/src/rust_toolchain.rs @@ -65,14 +65,16 @@ impl RustToolchain { /// Installs the Xtensa Rust toolchain. pub fn install_xtensa(&self) -> Result<()> { - if self.toolchain_destination.exists() { - // TODO: This should end the installation. - warn!( + #[cfg(unix)] + let toolchain_path = self.toolchain_destination.clone(); + #[cfg(windows)] + let toolchain_path = self.toolchain_destination.clone().join("esp"); + if toolchain_path.exists() { + bail!( "{} Previous installation of Rust Toolchain exist in: {}.\n Please, remove the directory before new installation.", emoji::WARN, self.toolchain_destination.display() ); - return Ok(()); } info!("{} Installing Xtensa Rust toolchain", emoji::WRENCH);