From 475ddbbede706624f6b332c06a035f2319a88f8e Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Fri, 13 Oct 2023 02:49:43 +0200 Subject: refactor: Move `get_host_os` to module (#618) In an effort to clean up `main.rs` --- src-tauri/src/main.rs | 8 +------- src-tauri/src/northstar/mod.rs | 3 ++- src-tauri/src/platform_specific/mod.rs | 6 ++++++ 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] -- cgit v1.2.3