diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2023-05-11 23:22:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-11 23:22:36 +0200 |
commit | 95fa3d72ace4d92f235ac0da1f5333a50201d441 (patch) | |
tree | 32974f136b186a3fbbce86d4faad1417f4653b18 /src-tauri | |
parent | 57d9b827fde3bf587e3a0b146f0ec70ddb52f5aa (diff) | |
download | FlightCore-95fa3d72ace4d92f235ac0da1f5333a50201d441.tar.gz FlightCore-95fa3d72ace4d92f235ac0da1f5333a50201d441.zip |
refactor: Move some functions to utility module (#347)
* refactor: Move `force_panic` to utility module
* refactor: Move `is_debug_mode` to utility module
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/src/main.rs | 19 | ||||
-rw-r--r-- | src-tauri/src/util.rs | 14 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 4fcb4b63..6b90093e 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -31,6 +31,8 @@ use northstar::get_northstar_version_number; mod thunderstore; use thunderstore::query_thunderstore_packages_api; +mod util; + use semver::Version; use serde::{Deserialize, Serialize}; use tauri::{Manager, Runtime}; @@ -119,7 +121,7 @@ fn main() { }) .manage(Counter(Default::default())) .invoke_handler(tauri::generate_handler![ - force_panic, + util::force_panic, find_game_install_location_caller, get_flightcore_version_number, get_northstar_version_number_caller, @@ -135,7 +137,7 @@ fn main() { repair_and_verify::verify_game_files, mod_management::set_mod_enabled_status, repair_and_verify::disable_all_but_core, - is_debug_mode, + util::is_debug_mode, github::release_notes::get_northstar_release_notes, linux_checks, mod_management::get_installed_mods_and_properties, @@ -201,19 +203,6 @@ async fn find_game_install_location_caller() -> Result<GameInstall, String> { find_game_install_location() } -/// This function's only use is to force a `panic!()` -// This must NOT be async to ensure crashing whole application. -#[tauri::command] -fn force_panic() { - panic!("Force panicked!"); -} - -/// Returns true if built in debug mode -#[tauri::command] -async fn is_debug_mode() -> bool { - cfg!(debug_assertions) -} - /// Returns true if linux compatible #[tauri::command] async fn linux_checks() -> Result<(), String> { diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs new file mode 100644 index 00000000..0c2c5da4 --- /dev/null +++ b/src-tauri/src/util.rs @@ -0,0 +1,14 @@ +//! This module contains various utility/helper functions that do not fit into any other module + +/// This function's only use is to force a `panic!()` +// This must NOT be async to ensure crashing whole application. +#[tauri::command] +pub fn force_panic() { + panic!("Force panicked!"); +} + +/// Returns true if built in debug mode +#[tauri::command] +pub async fn is_debug_mode() -> bool { + cfg!(debug_assertions) +} |