aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-10-13 02:49:43 +0200
committerGitHub <noreply@github.com>2023-10-13 02:49:43 +0200
commit475ddbbede706624f6b332c06a035f2319a88f8e (patch)
tree2e15fb01cf7501844700ba7090ee80abff819a1a
parentf515a3b702f781c0da438840071def1b37d2e1bc (diff)
downloadFlightCore-475ddbbede706624f6b332c06a035f2319a88f8e.tar.gz
FlightCore-475ddbbede706624f6b332c06a035f2319a88f8e.zip
refactor: Move `get_host_os` to module (#618)
In an effort to clean up `main.rs`
-rw-r--r--src-tauri/src/main.rs8
-rw-r--r--src-tauri/src/northstar/mod.rs3
-rw-r--r--src-tauri/src/platform_specific/mod.rs6
3 files changed, 9 insertions, 8 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 6bb65a2c..3ad7a1ea 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -123,7 +123,7 @@ fn main() {
northstar::get_northstar_version_number,
check_is_northstar_outdated,
verify_install_location,
- get_host_os,
+ platform_specific::get_host_os,
install_northstar_caller,
update_northstar,
northstar::launch_northstar,
@@ -475,9 +475,3 @@ pub fn check_is_valid_game_path(game_install_path: &str) -> Result<(), String> {
}
Ok(())
}
-
-/// Returns identifier of host OS FlightCore is running on
-#[tauri::command]
-fn get_host_os() -> String {
- env::consts::OS.to_string()
-}
diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs
index 284eac41..a6b895db 100644
--- a/src-tauri/src/northstar/mod.rs
+++ b/src-tauri/src/northstar/mod.rs
@@ -6,7 +6,8 @@ pub mod profile;
use crate::util::check_ea_app_or_origin_running;
use crate::{
constants::{CORE_MODS, TITANFALL2_STEAM_ID},
- get_host_os, GameInstall, InstallType,
+ platform_specific::get_host_os,
+ GameInstall, InstallType,
};
use anyhow::anyhow;
diff --git a/src-tauri/src/platform_specific/mod.rs b/src-tauri/src/platform_specific/mod.rs
index d5acfde8..8dca9424 100644
--- a/src-tauri/src/platform_specific/mod.rs
+++ b/src-tauri/src/platform_specific/mod.rs
@@ -4,6 +4,12 @@ pub mod windows;
#[cfg(target_os = "linux")]
pub mod linux;
+/// Returns identifier of host OS FlightCore is running on
+#[tauri::command]
+pub fn get_host_os() -> String {
+ std::env::consts::OS.to_string()
+}
+
/// On Linux attempts to install NorthstarProton
/// On Windows simply returns an error message
#[tauri::command]