From 86d15cd3350aa8ee173b9b7e7c9edb15c14e4cec Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sat, 25 Feb 2023 16:53:18 -0700 Subject: [PATCH] Try extraction message fix Change version to distinguish from official release Slightly change metadata message --- package.json | 2 +- src-tauri/src/unzip.rs | 34 ++++++++++------------- src/ui/components/ServerLaunchSection.tsx | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 4a13950..13392c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cultivation", - "version": "1.0.10", + "version": "1.1.11-Thorny", "private": true, "dependencies": { "@tauri-apps/api": "^1.0.0-rc.5", diff --git a/src-tauri/src/unzip.rs b/src-tauri/src/unzip.rs index ee7c5bb..2693ca3 100644 --- a/src-tauri/src/unzip.rs +++ b/src-tauri/src/unzip.rs @@ -99,29 +99,27 @@ pub fn unzip( // Delete zip file match std::fs::remove_file(&zipfile) { Ok(_) => { + // Get any new directory that could have been created + let mut new_dir: String = String::new(); + for entry in read_dir(&write_path).unwrap() { + let entry = entry.unwrap(); + let entry_path = entry.path(); + if entry_path.is_dir() && !dirs.contains(&entry_path) { + new_dir = entry_path.to_str().unwrap().to_string(); + } + } + + let mut res_hash = std::collections::HashMap::new(); + res_hash.insert("file", zipfile.to_string()); + res_hash.insert("new_folder", new_dir); + + window.emit("extract_end", &res_hash).unwrap(); println!("Deleted zip file: {}", zipfile); } Err(e) => { println!("Failed to delete zip file: {}", e); } }; - - // Get any new directory that could have been created - let mut new_dir: String = String::new(); - for entry in read_dir(&write_path).unwrap() { - let entry = entry.unwrap(); - let entry_path = entry.path(); - if entry_path.is_dir() && !dirs.contains(&entry_path) { - new_dir = entry_path.to_str().unwrap().to_string(); - } - } - - let mut res_hash = std::collections::HashMap::new(); - res_hash.insert("file", zipfile.to_string()); - res_hash.insert("new_folder", new_dir); - - // Testing fix - //window.emit("extract_end", &res_hash).unwrap(); }); } @@ -151,8 +149,6 @@ fn extract_rar(rarfile: &str, _f: &File, full_path: &path::Path, _top_level: boo fn extract_zip(_zipfile: &str, f: &File, full_path: &path::Path, top_level: bool) -> bool { match zip_extract::extract(f, full_path, top_level) { Ok(_) => { - // Notify extract end when extract is actually complete - window.emit("extract_end", &res_hash).unwrap(); println!( "Extracted zip file to: {}", full_path.to_str().unwrap_or("Error") diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index 984c26f..73f48d7 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -129,7 +129,7 @@ export default class ServerLaunchSection extends React.Component if (gameVersion?.major == 3 && gameVersion?.minor >= 1) { alert( - 'Game version is too new for metadata patching. Please disable metadata patching in the settings to launch the game.\nNOTE: You will require a UA patch to play the game.' + 'Game version is too new for metadata patching. TO FIX: Please disable metadata patching in the settings menu to launch the game!! \nNOTE: You will require an RSA patch to play the game.' ) return }