diff options
-rw-r--r-- | src-tauri/src/lib.rs | 16 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 17 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index e22801c5..5e187edf 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -64,22 +64,6 @@ struct InstallProgress { state: InstallState, } -/// Check version number of a mod -pub fn check_mod_version_number(path_to_mod_folder: &str) -> Result<String, anyhow::Error> { - // println!("{}", format!("{}/mod.json", path_to_mod_folder)); - let data = std::fs::read_to_string(format!("{path_to_mod_folder}/mod.json"))?; - let parsed_json: serde_json::Value = serde_json::from_str(&data)?; - // println!("{}", parsed_json); - let mod_version_number = match parsed_json.get("Version").and_then(|value| value.as_str()) { - Some(version_number) => version_number, - None => return Err(anyhow!("No version number found")), - }; - - log::info!("{}", mod_version_number); - - Ok(mod_version_number.to_string()) -} - // I intend to add more linux related stuff to check here, so making a func // for now tho it only checks `ldd --version` // - salmon diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index d26ecb64..a969d456 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -1,10 +1,25 @@ //! This module deals with handling things around Northstar such as //! - getting version number -use crate::{check_mod_version_number, constants::CORE_MODS}; +use crate::constants::CORE_MODS; use anyhow::anyhow; use app::{check_origin_running, get_host_os, GameInstall, InstallType}; +/// Check version number of a mod +pub fn check_mod_version_number(path_to_mod_folder: &str) -> Result<String, anyhow::Error> { + let data = std::fs::read_to_string(format!("{path_to_mod_folder}/mod.json"))?; + let parsed_json: serde_json::Value = serde_json::from_str(&data)?; + + let mod_version_number = match parsed_json.get("Version").and_then(|value| value.as_str()) { + Some(version_number) => version_number, + None => return Err(anyhow!("No version number found")), + }; + + log::info!("{}", mod_version_number); + + Ok(mod_version_number.to_string()) +} + /// Returns the current Northstar version number as a string pub fn get_northstar_version_number(game_path: &str) -> Result<String, anyhow::Error> { log::info!("{}", game_path); |