From ad4de0086b1f2cce2f93aad1b636cf896faa1a39 Mon Sep 17 00:00:00 2001 From: DIDIRUS4 Date: Tue, 16 Jan 2024 23:10:04 +0300 Subject: [PATCH] =?UTF-8?q?[beta]=20Development=20Build=20v21=20=E2=80=A2?= =?UTF-8?q?=20Beta.=20Fix=20auto=20start=20installer=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theseus/src/api/download.rs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/theseus/src/api/download.rs b/theseus/src/api/download.rs index 4ecbf21d3..47bffbad8 100644 --- a/theseus/src/api/download.rs +++ b/theseus/src/api/download.rs @@ -1,4 +1,5 @@ use std::process::exit; +use std::ptr::null; use reqwest; use tokio::fs::File as AsyncFile; use tokio::io::AsyncWriteExt; @@ -13,12 +14,28 @@ async fn download_file(download_url: &str, local_filename: &str, open_cmd: &str, dest_file.write_all(&bytes).await?; println!("[download_file] • File downloaded to: {:?}", full_path); if (auto_update_supported) { - let status = Command::new(open_cmd) - .arg(full_path.to_str().unwrap_or_default()) - .status() - .await - .expect("[download_file] • Failed to execute 'open' command"); - + let status; + if (open_cmd == "start") { + status = Command::new("cmd") + .arg("/C") + .arg("start") + .arg(full_path.to_str().unwrap_or_default()) + .status() + .await + .expect("[download_file] • Failed to execute 'start' command"); + } else if (open_cmd == "open") { + status = Command::new(open_cmd) + .arg(full_path.to_str().unwrap_or_default()) + .status() + .await + .expect("[download_file] • Failed to execute 'open' command"); + } else { + status = Command::new(open_cmd) + .arg(full_path.to_str().unwrap_or_default()) + .status() + .await + .expect("[download_file] • Failed to execute installer"); + } if status.success() { println!("[download_file] • File opened successfully!"); } else {