Skip to content

Commit

Permalink
Fixed XModem get, which now does not overwrite files. Thanks to TomC …
Browse files Browse the repository at this point in the history
…on MoHPC!
  • Loading branch information
liamhays committed Sep 18, 2022
1 parent ee46ff6 commit f56af02
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/xmodem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ pub fn send_file_conn4x(path: &PathBuf, port: &mut Box<dyn serialport::SerialPor
if *finish {
finish_server(port);
}


}

Expand Down Expand Up @@ -392,13 +393,14 @@ pub fn get_file(path: &PathBuf, port: &mut Box<dyn serialport::SerialPort>, dire
}
}
};


println!("final_path in get_file is {:?}", final_path);
// original_fname is the filename only of the path passed to the code
// final_fname is the filename only of the path we're writing to
let original_fname = path.file_name().unwrap().to_str().unwrap();
let final_fname = final_path.file_name().unwrap().to_str().unwrap();

let mut file = File::create(path).unwrap();
let mut file = File::create(final_path.clone()).unwrap();

// hp_fname is the list of bytes we actually send to the calculator, with HP 48 byte conversion
let mut hp_fname: Vec<u8> = Vec::new();
Expand Down

0 comments on commit f56af02

Please sign in to comment.