Merge pull request #114 from esp-rs/fix/llvm-uninstall

Improve LLVM uninstall
This commit is contained in:
Sergio Gasquez Arcos 2022-12-23 16:04:53 +01:00 committed by GitHub
commit fa18737382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -302,9 +302,10 @@ async fn uninstall(args: UninstallOpts) -> Result<()> {
if let Some(llvm_path) = config.llvm_path {
info!("{} Deleting Xtensa LLVM", emoji::WRENCH);
let llvm_path = llvm_path.parent().unwrap();
config.llvm_path = None;
config.save()?;
remove_dir_all(&llvm_path)
remove_dir_all(llvm_path)
.map_err(|_| Error::FailedToRemoveDirectory(llvm_path.display().to_string()))?;
}

View File

@ -131,11 +131,12 @@ impl XtensaRust {
/// Removes the Xtensa Rust toolchain.
pub fn uninstall(&self) -> Result<()> {
info!("{} Uninstalling Xtensa Rust toolchain", emoji::WRENCH);
remove_dir_all(&self.toolchain_destination)
let toolchain_path = self.toolchain_destination.clone();
#[cfg(windows)]
let toolchain_path = toolchain_path.join("esp");
remove_dir_all(&toolchain_path)
.into_diagnostic()
.map_err(|_| {
Error::FailedToRemoveDirectory(self.toolchain_destination.display().to_string())
})?;
.map_err(|_| Error::FailedToRemoveDirectory(toolchain_path.display().to_string()))?;
Ok(())
}
}