Fix the ROM's reload command

This commit is contained in:
pjht 2023-01-28 08:20:02 -06:00
parent 5c0edf982a
commit b7de519e47
Signed by: pjht
GPG Key ID: E911DEB42C25F8E1

View File

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