0.2.2: bug fix files w/ no extension

This commit is contained in:
Adam 2025-08-17 01:08:22 +01:00
parent 5c098cfc98
commit 4d3f31cdc4
3 changed files with 5 additions and 9 deletions

2
Cargo.lock generated
View File

@ -4,7 +4,7 @@ version = 4
[[package]] [[package]]
name = "bin2hpp" name = "bin2hpp"
version = "0.2.1" version = "0.2.2"
dependencies = [ dependencies = [
"thiserror", "thiserror",
] ]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "bin2hpp" name = "bin2hpp"
version = "0.2.1" version = "0.2.2"
authors = ["Adam Macdonald"] authors = ["Adam Macdonald"]
edition = "2024" edition = "2024"
license = "GPL-3.0-only" license = "GPL-3.0-only"

View File

@ -87,16 +87,12 @@ pub fn parse_config_from_args(args: &CliArgs) -> Result<Config, ProgramConfigErr
stem.retain(|c| c.is_ascii_alphanumeric()); stem.retain(|c| c.is_ascii_alphanumeric());
let mut ext: String = match args.input_file_path.extension() { let mut ext: String = match args.input_file_path.extension() {
Some(s) => s.to_string_lossy().to_string(), Some(s) => format!("_{}", s.to_string_lossy()),
None => { None => "".to_string(),
return Err(ProgramConfigError::InvalidPath(
args.input_file_path.to_string_lossy().to_string(),
));
}
}; };
ext.retain(|c| c.is_ascii_alphanumeric()); ext.retain(|c| c.is_ascii_alphanumeric());
format!("{}_{}", stem.to_ascii_uppercase(), ext.to_ascii_uppercase()) format!("{}{}", stem.to_ascii_uppercase(), ext.to_ascii_uppercase())
} }
}, },
namespace: match &args.namespace { namespace: match &args.namespace {