Skip to content

Commit

Permalink
fix: Output path should use OsStr, so that it can contain bytes that …
Browse files Browse the repository at this point in the history
…are invalid in utf-8

Modify the arg reading code in main.rs and upgrade to a2lfile 1.1.0 for the
other half of this fix.
  • Loading branch information
DanielT committed Dec 30, 2021
1 parent 1bd82fe commit 77ecf75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
a2lfile = "1.0.0"
a2lfile = "1.1.0"
object = "~0.28"
gimli = { version = "~0.26", features = ["read"] }
memmap = "~0.7"
Expand Down
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ fn core() -> Result<(), String> {
}

// load elf
let elf_info = if arg_matches.is_present("ELFFILE") {
let elffile = arg_matches.value_of_os("ELFFILE").unwrap();
let elf_info = if let Some(elffile) = arg_matches.value_of_os("ELFFILE") {
let elf_info = DebugData::load(elffile, verbose > 0)?;
cond_print!(verbose, now, format!("Variables and types loaded from \"{}\": {} variables available", elffile.to_string_lossy(), elf_info.variables.len()));
if debugprint {
Expand Down Expand Up @@ -247,10 +246,11 @@ fn core() -> Result<(), String> {
// output
if arg_matches.is_present("OUTPUT") {
a2l_file.sort_new_items();
let out_filename = arg_matches.value_of("OUTPUT").unwrap();
let banner = &*format!("a2ltool {}", crate_version!());
a2l_file.write(out_filename, Some(banner))?;
cond_print!(verbose, now, format!("Output written to \"{}\"", out_filename));
if let Some(out_filename) = arg_matches.value_of_os("OUTPUT") {
let banner = &*format!("a2ltool {}", crate_version!());
a2l_file.write(out_filename, Some(banner))?;
cond_print!(verbose, now, format!("Output written to \"{}\"", out_filename.to_string_lossy()));
}
}


Expand Down

0 comments on commit 77ecf75

Please sign in to comment.