Fix the ROM's reload command
This commit is contained in:
parent
d726d7b9df
commit
5da5f6523d
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user