From bb7961dc86414a74cf48f06e9b798b359912796e Mon Sep 17 00:00:00 2001 From: Juraj Michalek Date: Fri, 11 Aug 2023 15:52:33 +0200 Subject: [PATCH] move check of rustup --- src-tauri/src/rust.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src-tauri/src/rust.rs b/src-tauri/src/rust.rs index fcededf..f4bbf0b 100644 --- a/src-tauri/src/rust.rs +++ b/src-tauri/src/rust.rs @@ -141,17 +141,6 @@ pub async fn install_rustup(window: Window, app: tauri::AppHandle, selected_vari let output_dir = dirs::home_dir().ok_or("Failed to get home directory")?.join(".cargo").join("bin"); let rustup_path = output_dir.join(fname).to_str().unwrap().to_string(); - // Check if rustup is already installed - match Command::new(rustup_path.clone()).arg("--version").output() { - Ok(output) => { - if output.status.success() { - info!("Rustup already installed"); - return Ok("Rustup already installed".into()); - } - }, - Err(_) => {} - } - info!("Installing rustup..."); #[cfg(target_os = "windows")] @@ -197,6 +186,18 @@ async fn download_rustup(window: Window, app: AppHandle) -> Result { + if output.status.success() { + info!("Rustup already installed"); + return Ok("Rustup already installed".into()); + } + }, + Err(_) => {} + } + // Use the download_file function to download the file download_file(window.clone(), app.clone(), url, &output_path).await.map_err(|e| format!("Failed to download rustup: {:?}", e))?;