aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/northstar/mod.rs
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-22 19:02:03 +0100
committerGitHub <noreply@github.com>2022-11-22 19:02:03 +0100
commitc49af0ce6d95d0529ddb06908c3f65867bae89ca (patch)
treef522e5e899c56c5794122392263ab556227a6a6d /src-tauri/src/northstar/mod.rs
parent71072b86032d58408bf2a53cfddd6c0da45b3fe6 (diff)
downloadFlightCore-c49af0ce6d95d0529ddb06908c3f65867bae89ca.tar.gz
FlightCore-c49af0ce6d95d0529ddb06908c3f65867bae89ca.zip
refactor: Start moving NS related logic to own mod (#63)
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)
+}