aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-27 21:29:38 +0100
committerGitHub <noreply@github.com>2022-11-27 21:29:38 +0100
commit13ff1b0a50fa94d4f35ee1868ef3874a619f4165 (patch)
tree72e76d437df02b5d223fb3ade27acc1ad5d9992e /src-tauri/src
parent197ce5dc69dcb08a052492361f884d15d2dfd6a7 (diff)
downloadFlightCore-13ff1b0a50fa94d4f35ee1868ef3874a619f4165.tar.gz
FlightCore-13ff1b0a50fa94d4f35ee1868ef3874a619f4165.zip
feat: Option to launch NS bypassing update check (#59)
* feat: Option to launch NS bypassing update check Hidden behind dev view * refactor: Use existing function to launch NS Instead of duplicating code * feat: Adjust button to allow bypassing all checks
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/lib.rs35
-rw-r--r--src-tauri/src/main.rs7
2 files changed, 28 insertions, 14 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index fbef3bac..bfac47c7 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -232,12 +232,31 @@ pub fn get_host_os() -> String {
env::consts::OS.to_string()
}
-pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> {
+pub fn launch_northstar(
+ game_install: GameInstall,
+ bypass_checks: Option<bool>,
+) -> Result<String, String> {
dbg!(game_install.clone());
- // Some safety checks before, should have more in the future
- if get_northstar_version_number(game_install.game_path.clone()).is_err() {
- return Err(anyhow!("Not all checks were met").to_string());
+ let bypass_checks = match bypass_checks {
+ Some(bypass_checks) => bypass_checks,
+ None => false,
+ };
+
+ // Only check guards if bypassing checks is not enabled
+ if !bypass_checks {
+ // Some safety checks before, should have more in the future
+ if get_northstar_version_number(game_install.game_path.clone()).is_err() {
+ return Err(anyhow!("Not all checks were met").to_string());
+ }
+
+ // Require Origin to be running to launch Northstar
+ let origin_is_running = check_origin_running();
+ if !origin_is_running {
+ return Err(
+ anyhow!("Origin not running, start Origin before launching Northstar").to_string(),
+ );
+ }
}
let host_os = get_host_os();
@@ -262,14 +281,6 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> {
return Err(anyhow!("Couldn't access Titanfall2 directory").to_string());
}
- // Require Origin to be running to launch Northstar
- let origin_is_running = check_origin_running();
- if !origin_is_running {
- return Err(
- anyhow!("Origin not running, start Origin before launching Northstar").to_string(),
- );
- }
-
// Only Windows with Steam or Origin are supported at the moment
if host_os == "windows"
&& (matches!(game_install.install_type, InstallType::STEAM)
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index d775d978..8947d743 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -266,8 +266,11 @@ async fn update_northstar_caller(
#[tauri::command]
/// Launches Northstar
-async fn launch_northstar_caller(game_install: GameInstall) -> Result<String, String> {
- launch_northstar(game_install)
+async fn launch_northstar_caller(
+ game_install: GameInstall,
+ bypass_checks: Option<bool>,
+) -> Result<String, String> {
+ launch_northstar(game_install, bypass_checks)
}
#[tauri::command]