Skip to content

Commit

Permalink
fix: hide console for everest installation
Browse files Browse the repository at this point in the history
  • Loading branch information
std-microblock committed Feb 17, 2024
1 parent c4edb60 commit acc8872
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/aria2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ pub fn download_file_with_progress(

println!("[ ARIA2C ] Downloading {} to {}", url, output_path);

const CREATE_NO_WINDOW: u32 = 0x08000000;
const DETACHED_PROCESS: u32 = 0x00000008;


let output_path = Path::new(output_path);
// 构建 aria2c 命令
Expand Down Expand Up @@ -75,6 +74,8 @@ pub fn download_file_with_progress(
.stdout(Stdio::piped())
.stderr(Stdio::piped());

const CREATE_NO_WINDOW: u32 = 0x08000000;
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(target_os = "windows")]
let command = command.creation_flags(CREATE_NO_WINDOW).spawn();

Expand Down
18 changes: 15 additions & 3 deletions src/everest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ fn run_command(
let mut cmd = Command::new(&installer_path);
cmd.stdout(Stdio::piped());
cmd.stderr(Stdio::piped());
const CREATE_NO_WINDOW: u32 = 0x08000000;
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(target_os = "windows")]
use std::os::windows::process::CommandExt;
#[cfg(target_os = "windows")]
let cmd = cmd.creation_flags(CREATE_NO_WINDOW);

cmd.current_dir(
installer_path
.parent()
Expand Down Expand Up @@ -134,9 +141,14 @@ pub fn download_and_install_everest(
let temp_path = temp_path.to_str().unwrap();
let game_path = game_path.to_str().unwrap();

aria2c::download_file_with_progress(url, temp_path, &mut |callback| {
progress_callback("Downloading Everest".to_string(), callback.progress);
}, false)?;
aria2c::download_file_with_progress(
url,
temp_path,
&mut |callback| {
progress_callback("Downloading Everest".to_string(), callback.progress);
},
false,
)?;

progress_callback("Installing Everest".to_string(), 50.0);

Expand Down

0 comments on commit acc8872

Please sign in to comment.