diff options
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/src/main.rs | 4 | ||||
-rw-r--r-- | src-tauri/src/repair_and_verify/log_handling.rs | 20 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 06adf784..015ac925 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -37,7 +37,7 @@ use tauri::Manager; use tauri_plugin_store::PluginBuilder; use tokio::time::sleep; -use crate::repair_and_verify::log_handling::parse_given_log_text_for_installed_mods; +use crate::repair_and_verify::log_handling::parse_given_log_text; #[derive(Default)] struct Counter(Arc<Mutex<i32>>); @@ -112,7 +112,7 @@ fn main() { delete_northstar_mod, get_server_player_count, delete_thunderstore_mod, - parse_given_log_text_for_installed_mods, + parse_given_log_text, ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-tauri/src/repair_and_verify/log_handling.rs b/src-tauri/src/repair_and_verify/log_handling.rs index 6bb6528e..2b394a23 100644 --- a/src-tauri/src/repair_and_verify/log_handling.rs +++ b/src-tauri/src/repair_and_verify/log_handling.rs @@ -9,10 +9,7 @@ pub struct ParsedLogResults { } /// Parse logs for installed mods -#[tauri::command] -pub async fn parse_given_log_text_for_installed_mods( - log_text: String, -) -> Result<ParsedLogResults, String> { +fn parse_given_log_text_for_installed_mods(log_text: String) -> Result<Vec<String>, String> { // Regex to capture mod loading let regex = Regex::new(r"(?m)Loaded mod (.*) successfully\n").unwrap(); @@ -30,10 +27,17 @@ pub async fn parse_given_log_text_for_installed_mods( }; } - let parsed_log_results = ParsedLogResults { - installed_mods: mods, - }; - // Return the captured mod names + return Ok(mods); +} + +/// Parse logs for installed mods +#[tauri::command] +pub async fn parse_given_log_text(log_text: String) -> Result<ParsedLogResults, String> { + let installed_mods = parse_given_log_text_for_installed_mods(log_text)?; + + let parsed_log_results = ParsedLogResults { installed_mods }; + + // Return the parsed results return Ok(parsed_log_results); } |