From 5db28756d22e50a44937dd2da1ed3fd9ebd31e26 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 24 Sep 2023 02:19:14 -0600 Subject: [PATCH] Fix launch args setting --- src-tauri/src/config.rs | 2 ++ src/ui/components/ServerLaunchSection.tsx | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs index b793bef..3c806c4 100644 --- a/src-tauri/src/config.rs +++ b/src-tauri/src/config.rs @@ -28,6 +28,8 @@ pub struct Configuration { pub auto_mongodb: Option, pub un_elevated: Option, pub redirect_more: Option, + pub launch_args: Option, + pub offline_mode: Option, } pub fn config_path() -> PathBuf { diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index d315bfa..d1da316 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -217,10 +217,19 @@ export default class ServerLaunchSection extends React.Component args: config.launch_args, }) } else { - await invoke('run_program_relative', { - path: exe || config.game_install_path, - args: config.launch_args, - }) + if (config.launch_args.length < 1) { + // Run relative when there are no args + await invoke('run_program_relative', { + path: exe || config.game_install_path, + args: config.launch_args, + }) + } else { + // Run directly when there are args + await invoke('run_program', { + path: exe || config.game_install_path, + args: config.launch_args, + }) + } } else alert('Game not found! At: ' + (exe || config.game_install_path)) }