add cmd arg for noita exe path

This commit is contained in:
kcalbxof 2024-11-30 07:08:02 +03:00
parent f40b13a628
commit a5c1b0ceee
3 changed files with 14 additions and 1 deletions

View file

@ -21,6 +21,8 @@ use crate::{
steam_helper::SteamState,
};
use crate::util::args::Args;
#[derive(Default)]
enum State {
#[default]
@ -150,9 +152,16 @@ impl Modmanager {
ui: &mut Ui,
settings: &mut ModmanagerSettings,
steam_state: Option<&mut SteamState>,
args: &Args,
) {
if let State::JustStarted = self.state {
if check_path_valid(&settings.game_exe_path) {
if let Some(path) = &args.exe_path {
if check_path_valid(path) {
settings.game_exe_path = path.to_path_buf();
info!("Path from command line is valid, checking mod now");
self.state = State::PreCheckMod;
}
} else if check_path_valid(&settings.game_exe_path) {
info!("Path is valid, checking mod now");
self.state = State::PreCheckMod;
} else {

View file

@ -1501,6 +1501,7 @@ impl eframe::App for App {
ui,
&mut self.modmanager_settings,
self.steam_state.as_mut().ok(),
&self.args,
)
});
if self.modmanager.is_done() {

View file

@ -20,4 +20,7 @@ pub struct Args {
/// host either steam or ip.
#[argh(option)]
pub host: Option<String>,
/// noita.exe path
#[argh(option)]
pub exe_path: Option<PathBuf>,
}