mirror of
https://github.com/esp-rs/espup.git
synced 2025-09-28 13:20:41 +00:00
refactor: ♻️ Add uninstall methods
This commit is contained in:
parent
abf4d4d7c0
commit
8f2ce52020
@ -12,7 +12,10 @@ use async_trait::async_trait;
|
||||
use embuild::espidf::EspIdfVersion;
|
||||
use log::{debug, warn};
|
||||
use miette::Result;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
fs::remove_dir_all,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
const DEFAULT_GCC_REPOSITORY: &str = "https://github.com/espressif/crosstool-NG/releases/download";
|
||||
const DEFAULT_GCC_RELEASE: &str = "esp-2021r2-patch5";
|
||||
@ -67,6 +70,19 @@ impl Gcc {
|
||||
version: DEFAULT_GCC_VERSION.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uninstall(target: &Target) -> Result<(), Error> {
|
||||
let gcc_path = get_tool_path(&get_toolchain_name(target));
|
||||
remove_dir_all(&gcc_path).map_err(|_| Error::FailedToRemoveDirectory(gcc_path))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uninstall_riscv() -> Result<(), Error> {
|
||||
let riscv_gcc_path = get_tool_path(RISCV_GCC);
|
||||
remove_dir_all(&riscv_gcc_path)
|
||||
.map_err(|_| Error::FailedToRemoveDirectory(riscv_gcc_path))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
Loading…
x
Reference in New Issue
Block a user