aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/main.rs43
1 files changed, 2 insertions, 41 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 9d3b8297..5d71713a 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -453,10 +453,6 @@ async fn get_available_northstar_versions() -> Result<Vec<NorthstarThunderstoreR
Ok(releases)
}
-// The remaining below was originally in `lib.rs`.
-// As this was causing issues it was moved into `main.rs` until being later moved into dedicated modules
-use std::{fs, path::Path};
-
use anyhow::Result;
pub mod constants;
@@ -579,43 +575,8 @@ fn launch_northstar_steam(
return Err("Couldn't access Titanfall2 directory".to_string());
}
- let run_northstar = "run_northstar.txt";
- let run_northstar_bak = "run_northstar.txt.bak";
-
- if Path::new(run_northstar).exists() {
- // rename should ovewrite existing files
- fs::rename(run_northstar, run_northstar_bak).unwrap();
- }
-
- // Passing arguments gives users a prompt, so we use run_northstar.txt
- fs::write(run_northstar, b"1").unwrap();
-
- let retval = match open::that(format!("steam://run/{}/", TITANFALL2_STEAM_ID)) {
+ match open::that(format!("steam://run/{}//--northstar/", TITANFALL2_STEAM_ID)) {
Ok(()) => Ok("Started game".to_string()),
Err(_err) => Err("Failed to launch Titanfall 2 via Steam".to_string()),
- };
-
- let is_err = retval.is_err();
-
- // Handle the rest in the backround
- tauri::async_runtime::spawn(async move {
- // Starting the EA app and Titanfall might take a good minute or three
- let mut wait_countdown = 60 * 3;
- while wait_countdown > 0 && !util::check_northstar_running() && !is_err {
- sleep(Duration::from_millis(1000)).await;
- wait_countdown -= 1;
- }
-
- // Northstar may be running, but it may not have loaded the file yet
- sleep(Duration::from_millis(2000)).await;
-
- // intentionally ignore Result
- let _ = fs::remove_file(run_northstar);
-
- if Path::new(run_northstar_bak).exists() {
- fs::rename(run_northstar_bak, run_northstar).unwrap();
- }
- });
-
- retval
+ }
}