chore: 🎨 Exit the program if there is an existing esp toolchain installed

This commit is contained in:
Sergio Gasquez 2022-09-20 14:10:52 +00:00
parent 0afb642092
commit e1bdee7045

View File

@ -65,14 +65,16 @@ impl RustToolchain {
/// Installs the Xtensa Rust toolchain. /// Installs the Xtensa Rust toolchain.
pub fn install_xtensa(&self) -> Result<()> { pub fn install_xtensa(&self) -> Result<()> {
if self.toolchain_destination.exists() { #[cfg(unix)]
// TODO: This should end the installation. let toolchain_path = self.toolchain_destination.clone();
warn!( #[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.", "{} Previous installation of Rust Toolchain exist in: {}.\n Please, remove the directory before new installation.",
emoji::WARN, emoji::WARN,
self.toolchain_destination.display() self.toolchain_destination.display()
); );
return Ok(());
} }
info!("{} Installing Xtensa Rust toolchain", emoji::WRENCH); info!("{} Installing Xtensa Rust toolchain", emoji::WRENCH);