Skip to content

Commit

Permalink
fix: use non parsed version string to check if version is used
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhas07 committed Jan 29, 2024
1 parent b6a496f commit f874ea3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/handlers/uninstall_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn start(version: Option<&str>, config: Config) -> Result<()> {
};

let version = helpers::version::parse_version_type(&client, version).await?;
if helpers::version::is_version_used(&version.tag_name, &config).await {
if helpers::version::is_version_used(&version.non_parsed_string, &config).await {
warn!("Switch to a different version before proceeding");
return Ok(());
}
Expand All @@ -32,10 +32,13 @@ pub async fn start(version: Option<&str>, config: Config) -> Result<()> {
Err(error) => return Err(anyhow!(error)),
};

let path = downloads_dir.join(&version.tag_name);
let path = downloads_dir.join(&version.non_parsed_string);

fs::remove_dir_all(path).await?;
info!("Successfully uninstalled version: {}", version.tag_name);
info!(
"Successfully uninstalled version: {}",
version.non_parsed_string
);
Ok(())
}

Expand All @@ -53,10 +56,10 @@ async fn uninstall_selections(client: &Client, config: &Config) -> Result<()> {
Err(_) => continue,
};

if helpers::version::is_version_used(&version.tag_name, config).await {
if helpers::version::is_version_used(&version.non_parsed_string, config).await {
continue;
}
installed_versions.push(version.tag_name);
installed_versions.push(version.non_parsed_string);
}

if installed_versions.is_empty() {
Expand Down

0 comments on commit f874ea3

Please sign in to comment.