From 02399ac5090888b852568eff9172f81d674f0448 Mon Sep 17 00:00:00 2001 From: Barnaby <22575741+barnabwhy@users.noreply.github.com> Date: Sat, 15 Jun 2024 17:08:44 +0100 Subject: [PATCH] more descriptive load progress --- src-tauri/src/main.rs | 8 +++++++- src/components/Loading.vue | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index ba039fb..17b9091 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -80,7 +80,11 @@ async fn select_vpk(window: Window) -> Option { } #[tauri::command] -async fn load_vpk(state: tauri::State<'_, AppState>, vpk_path: String) -> Result<(), String> { +async fn load_vpk( + state: tauri::State<'_, AppState>, + window: tauri::Window, + vpk_path: String, +) -> Result<(), String> { let mut file = File::open(&vpk_path).expect("Failed to open file"); let pak_format = detect_pak_format(&mut file); @@ -100,6 +104,8 @@ async fn load_vpk(state: tauri::State<'_, AppState>, vpk_path: String) -> Result let archive_path = vpk_archive_path(&vpk_path); let vpk_name = get_vpk_name(&vpk_path); println!("Attempting to read VPK CAM files from: {}", &archive_path); + + let _ = window.emit("load_step", "Reading CAM files..."); vpk.read_all_cams(&archive_path, &vpk_name)?; state_guard.vpk_path = Some(vpk_path); diff --git a/src/components/Loading.vue b/src/components/Loading.vue index aff1dd7..bf788ae 100644 --- a/src/components/Loading.vue +++ b/src/components/Loading.vue @@ -1,10 +1,15 @@