aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/northstar/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri/src/northstar/mod.rs')
-rw-r--r--src-tauri/src/northstar/mod.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs
new file mode 100644
index 00000000..a7ec044a
--- /dev/null
+++ b/src-tauri/src/northstar/mod.rs
@@ -0,0 +1,44 @@
+//! This module deals with handling things around Northstar such as
+//! - getting version number
+
+use crate::check_mod_version_number;
+use anyhow::anyhow;
+
+/// Returns the current Northstar version number as a string
+pub fn get_northstar_version_number(game_path: String) -> Result<String, anyhow::Error> {
+ println!("{}", game_path);
+ // println!("{:?}", install_type);
+
+ // TODO:
+ // Check if NorthstarLauncher.exe exists and check its version number
+ let profile_folder = "R2Northstar";
+ let core_mods = [
+ "Northstar.Client",
+ "Northstar.Custom",
+ "Northstar.CustomServers",
+ ];
+ let initial_version_number = match check_mod_version_number(format!(
+ "{}/{}/mods/{}",
+ game_path, profile_folder, core_mods[0]
+ )) {
+ Ok(version_number) => version_number,
+ Err(err) => return Err(err),
+ };
+
+ for core_mod in core_mods {
+ let current_version_number = match check_mod_version_number(format!(
+ "{}/{}/mods/{}",
+ game_path, profile_folder, core_mod
+ )) {
+ Ok(version_number) => version_number,
+ Err(err) => return Err(err),
+ };
+ if current_version_number != initial_version_number {
+ // We have a version number mismatch
+ return Err(anyhow!("Found version number mismatch"));
+ }
+ }
+ println!("All mods same version");
+
+ Ok(initial_version_number)
+}