aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/northstar
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-07-17 14:12:46 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-07-17 14:12:46 +0200
commitbaa1c52126eae7980f49f39631e2c5931d5b478f (patch)
treeb27069d05074304c6837125314b851b753ab9fc7 /src-tauri/src/northstar
parentc8be2cc35d9440260e57c1169a8bffc81f16c2e9 (diff)
downloadFlightCore-baa1c52126eae7980f49f39631e2c5931d5b478f.tar.gz
FlightCore-baa1c52126eae7980f49f39631e2c5931d5b478f.zip
Add support for launch parameters
Diffstat (limited to 'src-tauri/src/northstar')
-rw-r--r--src-tauri/src/northstar/install.rs1
-rw-r--r--src-tauri/src/northstar/mod.rs8
2 files changed, 8 insertions, 1 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs
index 875458dd..71da515d 100644
--- a/src-tauri/src/northstar/install.rs
+++ b/src-tauri/src/northstar/install.rs
@@ -174,6 +174,7 @@ pub fn find_game_install_location() -> Result<GameInstall, String> {
// println!("{:#?}", app);
let game_install = GameInstall {
game_path: app.path.to_str().unwrap().to_string(),
+ launch_parameters: "".to_string(),
install_type: InstallType::STEAM,
};
return Ok(game_install);
diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs
index 47510dbd..2630ff1f 100644
--- a/src-tauri/src/northstar/mod.rs
+++ b/src-tauri/src/northstar/mod.rs
@@ -109,8 +109,14 @@ pub fn launch_northstar(
|| matches!(game_install.install_type, InstallType::UNKNOWN))
{
let ns_exe_path = format!("{}/NorthstarLauncher.exe", game_install.game_path);
+ let ns_params: Vec<&str> = game_install.launch_parameters.split_whitespace().collect();
+
+ let mut args = vec!["/C", "start", "", &ns_exe_path];
+ // We cannot add the params directly because of limitations with cmd.exe
+ // https://stackoverflow.com/questions/9964865/c-system-not-working-when-there-are-spaces-in-two-different-parameters/9965141#9965141
+ args.extend(ns_params);
let _output = std::process::Command::new("C:\\Windows\\System32\\cmd.exe")
- .args(["/C", "start", "", &ns_exe_path])
+ .args(args)
.spawn()
.expect("failed to execute process");
return Ok("Launched game".to_string());