Skip to content

Commit

Permalink
Fix default output path for extraction being cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Oct 1, 2023
1 parent df66247 commit 65c1124
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fastgmad-lib/src/extract/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,20 @@ impl ExtractGmaConfig {
_ => return Err(PrintHelp(Some("Unknown GMAD extraction argument"))),
}
}
Ok((config, r#in.ok_or(PrintHelp(Some("Please provide an output path")))?))

let r#in = r#in.ok_or(PrintHelp(Some("Please provide an input path")))?;

if config.out.as_os_str().is_empty() {
if let ExtractGmadIn::File(path) = &r#in {
let mut dir = path.to_owned();
dir.set_extension("");
if !dir.exists() || dir.is_dir() {
config.out = dir;
}
}
}

Ok((config, r#in))
}
}
impl Default for ExtractGmaConfig {
Expand Down

0 comments on commit 65c1124

Please sign in to comment.