diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-02-06 01:08:49 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-02-06 01:08:49 +0100 |
commit | 9fd1b18373b495a777edd724c875cd376ee8fb2f (patch) | |
tree | 879a5d9f7336e7ad2539932723c4dd628faebb79 /src-tauri | |
parent | 9093d938a8eb905d524f0b4308e4cb15a64d0c2a (diff) | |
download | FlightCore-9fd1b18373b495a777edd724c875cd376ee8fb2f.tar.gz FlightCore-9fd1b18373b495a777edd724c875cd376ee8fb2f.zip |
feat: Check log for Northstar crash
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/bindings/ParsedLogResults.ts | 2 | ||||
-rw-r--r-- | src-tauri/src/repair_and_verify/log_handling.rs | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src-tauri/bindings/ParsedLogResults.ts b/src-tauri/bindings/ParsedLogResults.ts index 7bc3239e..6ae3c0ad 100644 --- a/src-tauri/bindings/ParsedLogResults.ts +++ b/src-tauri/bindings/ParsedLogResults.ts @@ -1,4 +1,4 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { ParsedModFromLog } from "./ParsedModFromLog"; -export interface ParsedLogResults { northstar_launcher_version: string, installed_mods: Array<ParsedModFromLog>, }
\ No newline at end of file +export interface ParsedLogResults { northstar_launcher_version: string, installed_mods: Array<ParsedModFromLog>, has_northstar_crashed: boolean, }
\ No newline at end of file diff --git a/src-tauri/src/repair_and_verify/log_handling.rs b/src-tauri/src/repair_and_verify/log_handling.rs index 33e634cb..2cbc4ae6 100644 --- a/src-tauri/src/repair_and_verify/log_handling.rs +++ b/src-tauri/src/repair_and_verify/log_handling.rs @@ -14,6 +14,7 @@ pub struct ParsedModFromLog { pub struct ParsedLogResults { northstar_launcher_version: String, installed_mods: Vec<ParsedModFromLog>, + has_northstar_crashed: bool, } /// Parse logs for installed mods @@ -93,15 +94,22 @@ fn parse_for_northstar_launcher_version(log_text: String) -> Result<String, Stri } } +fn parse_log_for_crash(log_text: String) -> bool { + let pattern = Regex::new(r"(?m)Northstar has crashed!").unwrap(); + pattern.is_match(&log_text) +} + /// 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.clone())?; - let northstar_launcher_version = parse_for_northstar_launcher_version(log_text)?; + let northstar_launcher_version = parse_for_northstar_launcher_version(log_text.clone())?; + let has_northstar_crashed = parse_log_for_crash(log_text); let parsed_log_results = ParsedLogResults { northstar_launcher_version, installed_mods, + has_northstar_crashed, }; // Return the parsed results |