From b25a333f4d98fd58b7468423f1bec26daf3d7e7c Mon Sep 17 00:00:00 2001 From: Dave Corley Date: Mon, 14 Oct 2024 22:41:36 -0700 Subject: [PATCH] FIX: Actually make a function for verifying compile mode --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 57cc6fa..6c53b5b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,7 @@ fn main() { Arg::new("MODE") .help("Whether to compile in openmw, morrowind.exe, or librequake mode.") .long("mode") - .value_parser(validate_input_plugin), + .value_parser(validate_compile_mode), ]) .get_matches(); @@ -347,6 +347,13 @@ fn validate_input_plugin(arg: &str) -> Result { Ok(arg.into()) } +fn validate_compile_mode(arg: &str) -> Result { + if arg != "-" && arg != "librequake" && arg != "morrowind.exe" && arg != "openmw" { + return Err(format!("\"{}\" invalid compile mode", arg)); + } + Ok(arg.into()) +} + fn create_workdir(map_name: &String) -> (String, String) { let dir_index = map_name .rfind('/')