Skip to content

Commit

Permalink
[beta] Development Build v21 • Beta. Fix auto start installer?
Browse files Browse the repository at this point in the history
  • Loading branch information
DIDIRUS4 committed Jan 16, 2024
1 parent 94283a0 commit ad4de00
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions theseus/src/api/download.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::process::exit;
use std::ptr::null;

Check warning on line 2 in theseus/src/api/download.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `std::ptr::null`

warning: unused import: `std::ptr::null` --> theseus/src/api/download.rs:2:5 | 2 | use std::ptr::null; | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
use reqwest;
use tokio::fs::File as AsyncFile;
use tokio::io::AsyncWriteExt;
Expand All @@ -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) {

Check warning on line 16 in theseus/src/api/download.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary parentheses around `if` condition

warning: unnecessary parentheses around `if` condition --> theseus/src/api/download.rs:16:8 | 16 | if (auto_update_supported) { | ^ ^ | = note: `#[warn(unused_parens)]` on by default help: remove these parentheses | 16 - if (auto_update_supported) { 16 + 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") {

Check warning on line 18 in theseus/src/api/download.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary parentheses around `if` condition

warning: unnecessary parentheses around `if` condition --> theseus/src/api/download.rs:18:12 | 18 | if (open_cmd == "start") { | ^ ^ | help: remove these parentheses | 18 - if (open_cmd == "start") { 18 + 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") {

Check warning on line 26 in theseus/src/api/download.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary parentheses around `if` condition

warning: unnecessary parentheses around `if` condition --> theseus/src/api/download.rs:26:19 | 26 | } else if (open_cmd == "open") { | ^ ^ | help: remove these parentheses | 26 - } else if (open_cmd == "open") { 26 + } 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 {
Expand Down

0 comments on commit ad4de00

Please sign in to comment.