Skip to content

Commit 406c489

Browse files
committed
fix: update installation progress messages for clarity and accuracy
1 parent c5ab923 commit 406c489

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/celemod-ui/src/routes/Everest.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const Everest = () => {
106106
setInstallingUrl(url);
107107
setInstallProgress(null);
108108
setFailedReason(null);
109-
setInstallState('Downloading Everest');
109+
setInstallState('[1/3] Download Everest');
110110
callRemote(
111111
'download_and_install_everest',
112112
gamePath,
@@ -284,7 +284,7 @@ export const Everest = () => {
284284
/>
285285
</div>
286286
<div className="tip">
287-
{installState === 'Downloading Everest'
287+
{installState?.startsWith('[1/3]')
288288
? _i18n.t('正在下载')
289289
: _i18n.t('正在安装')}
290290
</div>

src/everest.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ fn run_command(
185185
lines
186186
});
187187

188-
let mut line_count = 50f32;
188+
let mut line_count = 0f32;
189189
for line in reader.lines() {
190190
let line = line?;
191-
line_count += 0.5;
192-
progress_callback(line, line_count);
191+
line_count = (line_count + 0.5).min(99.0);
192+
progress_callback(format!("[3/3] Run MiniInstaller: {line}"), line_count);
193193
}
194194

195195
let status = child.wait()?;
@@ -202,6 +202,8 @@ fn run_command(
202202
bail!("Command failed with error: {}", stderr);
203203
}
204204

205+
progress_callback("[3/3] Run MiniInstaller".to_string(), 100.0);
206+
205207
Ok(())
206208
}
207209

@@ -240,13 +242,13 @@ pub fn download_and_install_everest(
240242
url,
241243
temp_path,
242244
&mut |callback| {
243-
progress_callback("Downloading Everest".to_string(), callback.progress);
245+
progress_callback("[1/3] Download Everest".to_string(), callback.progress);
244246
},
245247
false,
246248
&cancel_flag,
247249
)?;
248250

249-
progress_callback("Installing Everest".to_string(), 50.0);
251+
progress_callback("[2/3] Extract Everest files".to_string(), 0.0);
250252

251253
// unzip everest/main/* to game_path and overwrite all
252254
let mut archive = zip::ZipArchive::new(std::fs::File::open(temp_path)?)?;
@@ -260,8 +262,8 @@ pub fn download_and_install_everest(
260262
// strip /main/ from the name
261263
let dist_name = dist_name.strip_prefix("main/")?;
262264
let outpath = game_path.join(dist_name);
263-
let status_str = format!("Extracting {}", outpath.display());
264-
progress_callback(status_str, 50.0 + (i as f32) / (archive_len as f32) * 40.0);
265+
let status_str = format!("[2/3] Extract Everest files: {}", outpath.display());
266+
progress_callback(status_str, (i as f32) / (archive_len as f32) * 100.0);
265267
if file.name().ends_with('/') {
266268
std::fs::create_dir_all(&outpath)?;
267269
} else {
@@ -285,7 +287,7 @@ pub fn download_and_install_everest(
285287
}
286288
}
287289

288-
progress_callback("Running Everest installer".to_string(), 90.0);
290+
progress_callback("[3/3] Run MiniInstaller".to_string(), 0.0);
289291
let installer_path = game_path.join(installer_name()?);
290292

291293
run_command(installer_path, progress_callback)

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ impl Handler {
14181418
.unwrap();
14191419
}) {
14201420
Ok(()) => {
1421-
callback2.call(None, &make_args!("Success"), None).unwrap();
1421+
callback2.call(None, &make_args!("Success", 100.0), None).unwrap();
14221422
}
14231423
Err(e) => {
14241424
callback2

0 commit comments

Comments
 (0)