Skip to content

Commit

Permalink
FIX: but actually there already was a function to validate the mode
Browse files Browse the repository at this point in the history
  • Loading branch information
magicaldave committed Oct 15, 2024
1 parent b25a333 commit 14c045c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions 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_compile_mode),
.value_parser(validate_mode),
])
.get_matches();

Expand All @@ -70,8 +70,6 @@ fn main() {

let mut plugin = esp::Plugin::from_path(plugin_name).unwrap_or(esp::Plugin::default());

create_header_if_missing(&mut plugin);

// Push the cell record to the plugin
// It can't be done multiple times :/
let mut cell = None;
Expand Down Expand Up @@ -270,6 +268,7 @@ fn main() {
.objects
.retain(|obj| !processed_base_objects.contains(&obj.editor_id().to_string()));
plugin.objects.extend(created_objects);
create_header_if_missing(&mut plugin);
plugin.sort_objects();
plugin
.save_path(plugin_name)
Expand Down Expand Up @@ -347,13 +346,6 @@ 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 14c045c

Please sign in to comment.