Skip to content

Commit

Permalink
FIX: Actually make a function for verifying compile mode
Browse files Browse the repository at this point in the history
  • Loading branch information
magicaldave committed Oct 15, 2024
1 parent 387060b commit b25a333
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -347,6 +347,13 @@ fn validate_input_plugin(arg: &str) -> Result<String, String> {
Ok(arg.into())
}

fn validate_compile_mode(arg: &str) -> Result<String, String> {
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('/')
Expand Down

0 comments on commit b25a333

Please sign in to comment.