aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-tauri/src/main.rs4
-rw-r--r--src-tauri/src/repair_and_verify/log_handling.rs20
-rw-r--r--src-vue/src/views/DeveloperView.vue2
3 files changed, 15 insertions, 11 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);
}
diff --git a/src-vue/src/views/DeveloperView.vue b/src-vue/src/views/DeveloperView.vue
index 87ee7772..d8423450 100644
--- a/src-vue/src/views/DeveloperView.vue
+++ b/src-vue/src/views/DeveloperView.vue
@@ -225,7 +225,7 @@ export default defineComponent({
},
async parseGivenLogTextForMods() {
let current_log_content = this.log_content;
- await invoke<[ParsedLogResults]>("parse_given_log_text_for_installed_mods", { logText: current_log_content })
+ await invoke<[ParsedLogResults]>("parse_given_log_text", { logText: current_log_content })
.then((message) => {
console.log(message); // TODO present better here
// Show user notification if task completed.