Fix the ROM's reload command

This commit is contained in:
pjht 2023-01-28 08:20:02 -06:00
parent c2b1a2a74d
commit 21181fc645
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -114,11 +114,11 @@ impl Card for Rom {
println!("Read ROM image file {}", cmd[1]); println!("Read ROM image file {}", cmd[1]);
} else if cmd[0] == "reload" { } else if cmd[0] == "reload" {
if let Some(file_name) = &self.file_name { if let Some(file_name) = &self.file_name {
let mut file = File::open(cmd[1]) let mut file = File::open(file_name)
.map_err(|e| anyhow!("Couldn't open ROM image file {} ({})", cmd[1], e))?; .map_err(|e| anyhow!("Couldn't open ROM image file {} ({})", file_name, e))?;
self.data.clear(); self.data.clear();
file.read_to_end(&mut self.data) file.read_to_end(&mut self.data)
.map_err(|e| anyhow!("Failed to read ROM image file {} ({})", cmd[1], e))?; .map_err(|e| anyhow!("Failed to read ROM image file {} ({})", file_name, e))?;
println!("Reloaded ROM image file {}", file_name); println!("Reloaded ROM image file {}", file_name);
} else { } else {
println!("No ROM image file to reload"); println!("No ROM image file to reload");