From 40520344778a98c45817e9cbc00caab6ec3ea6bf Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 30 Jul 2023 01:24:18 +0200 Subject: refactor: Add Profile to GameInstall (#453) Add Profile to GameInstall Replace hardcoded uses of R2Northstar with profile attribute --- src-tauri/src/northstar/install.rs | 2 ++ src-tauri/src/northstar/mod.rs | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src-tauri/src/northstar') diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index c77fd538..2d96b00e 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -190,6 +190,7 @@ pub fn find_game_install_location() -> Result { // println!("{:#?}", app); let game_install = GameInstall { game_path: app.path.to_str().unwrap().to_string(), + profile: "R2Northstar".to_string(), install_type: InstallType::STEAM, }; return Ok(game_install); @@ -206,6 +207,7 @@ pub fn find_game_install_location() -> Result { Ok(game_path) => { let game_install = GameInstall { game_path, + profile: "R2Northstar".to_string(), install_type: InstallType::ORIGIN, }; return Ok(game_install); diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index bf55603b..85d792d6 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -112,8 +112,10 @@ pub fn launch_northstar( || matches!(game_install.install_type, InstallType::UNKNOWN)) { let ns_exe_path = format!("{}/NorthstarLauncher.exe", game_install.game_path); + let ns_profile_arg = format!("-profile={}", game_install.profile); + let _output = std::process::Command::new("C:\\Windows\\System32\\cmd.exe") - .args(["/C", "start", "", &ns_exe_path]) + .args(["/C", "start", "", &ns_exe_path, &ns_profile_arg]) .spawn() .expect("failed to execute process"); return Ok("Launched game".to_string()); @@ -173,7 +175,10 @@ pub fn launch_northstar_steam( return Err("Couldn't access Titanfall2 directory".to_string()); } - match open::that(format!("steam://run/{}//--northstar/", TITANFALL2_STEAM_ID)) { + match open::that(format!( + "steam://run/{}//-profile={} --northstar/", + TITANFALL2_STEAM_ID, game_install.profile + )) { Ok(()) => Ok("Started game".to_string()), Err(_err) => Err("Failed to launch Titanfall 2 via Steam".to_string()), } -- cgit v1.2.3