diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 23:26:21 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 23:26:21 +0200 |
commit | 54e5b393128f6df4c013ff0866349cce4291d7b5 (patch) | |
tree | 27a9b9fa12dff3579aed72fd78bfe7ef5e141688 | |
parent | 9d3f82e13a73998f508ba65ef4076fb79982b13c (diff) | |
download | FlightCore-54e5b393128f6df4c013ff0866349cce4291d7b5.tar.gz FlightCore-54e5b393128f6df4c013ff0866349cce4291d7b5.zip |
Move get host OS function to lib.rs
-rw-r--r-- | src-tauri/src/lib.rs | 7 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 8 | ||||
-rw-r--r-- | src-ui/src/main.ts | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index da1ba9b8..d1073387 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,3 +1,5 @@ +use std::env; + use anyhow::{anyhow, Context, Result}; use powershell_script::PsScriptBuilder; use regex::Regex; @@ -244,3 +246,8 @@ pub async fn install_northstar(game_path: &str) -> Result<String> { Ok(nmod.version.clone()) } + +/// Returns identifier of host OS FlightCore is running on +pub fn get_host_os() -> String { + env::consts::OS.to_string() +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 09123040..0b436262 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -12,7 +12,7 @@ use std::{ use anyhow::anyhow; use app::{ check_is_valid_game_path, find_game_install_location, get_northstar_version_number, - install_northstar, GameInstall, InstallType, + install_northstar, GameInstall, InstallType, get_host_os, }; use tauri::{Manager, State}; use tokio::time::sleep; @@ -54,7 +54,7 @@ fn main() { get_northstar_version_number_caller, check_is_northstar_outdated, verify_install_location, - get_host_os, + get_host_os_caller, install_northstar_caller, update_northstar_caller, launch_northstar @@ -158,8 +158,8 @@ fn verify_install_location(game_path: String) -> bool { #[tauri::command] /// Returns identifier of host OS FlightCore is running on -fn get_host_os() -> String { - env::consts::OS.to_string() +fn get_host_os_caller() -> String { + get_host_os() } #[tauri::command] diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 98a772ad..fb61ac4a 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -201,7 +201,7 @@ document.addEventListener("DOMContentLoaded", async function () { // Get version number let version_number_string = await invoke("get_version_number") as string; // Get host OS - let host_os_string = await invoke("get_host_os") as string; + let host_os_string = await invoke("get_host_os_caller") as string; versionNumberHolderEl.textContent = `${version_number_string} (${host_os_string})`; // Get install location |