Skip to content

Commit acc8872

Browse files
fix: hide console for everest installation
1 parent c4edb60 commit acc8872

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/aria2c.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ pub fn download_file_with_progress(
4545

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

48-
const CREATE_NO_WINDOW: u32 = 0x08000000;
49-
const DETACHED_PROCESS: u32 = 0x00000008;
48+
5049

5150
let output_path = Path::new(output_path);
5251
// 构建 aria2c 命令
@@ -75,6 +74,8 @@ pub fn download_file_with_progress(
7574
.stdout(Stdio::piped())
7675
.stderr(Stdio::piped());
7776

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

src/everest.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ fn run_command(
9393
let mut cmd = Command::new(&installer_path);
9494
cmd.stdout(Stdio::piped());
9595
cmd.stderr(Stdio::piped());
96+
const CREATE_NO_WINDOW: u32 = 0x08000000;
97+
const DETACHED_PROCESS: u32 = 0x00000008;
98+
#[cfg(target_os = "windows")]
99+
use std::os::windows::process::CommandExt;
100+
#[cfg(target_os = "windows")]
101+
let cmd = cmd.creation_flags(CREATE_NO_WINDOW);
102+
96103
cmd.current_dir(
97104
installer_path
98105
.parent()
@@ -134,9 +141,14 @@ pub fn download_and_install_everest(
134141
let temp_path = temp_path.to_str().unwrap();
135142
let game_path = game_path.to_str().unwrap();
136143

137-
aria2c::download_file_with_progress(url, temp_path, &mut |callback| {
138-
progress_callback("Downloading Everest".to_string(), callback.progress);
139-
}, false)?;
144+
aria2c::download_file_with_progress(
145+
url,
146+
temp_path,
147+
&mut |callback| {
148+
progress_callback("Downloading Everest".to_string(), callback.progress);
149+
},
150+
false,
151+
)?;
140152

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

0 commit comments

Comments
 (0)