Made the code look a bit less ugly

This commit is contained in:
2025-09-24 13:19:01 +02:00
parent 9f4a61a7ec
commit 04b642776d

View File

@@ -264,20 +264,20 @@ fn monitor_chip(_args: ArgMonitor, target: &mut PhysicalTarget) -> Result<(), Er
}
fn run_chip(args: ArgRun, target: &mut PhysicalTarget) -> Result<(), Error> {
let parent_path = args.path.parent().unwrap().join("tulflash");
let base_file = parent_path.join(
args.path.file_name().ok_or(Error::other("invalid path to compilation source"))?);
let path = base_file.with_extension("ihx");
let sdcc_file = args.path.file_name().ok_or(Error::other("invalid path to compilation source"))?;
let cmd = Some(OsString::from(
format!("sdcc \"{}\"", sdcc_file.to_str().ok_or(Error::other("invalid path to compilation source"))?)
));
let cmd_path = Some(parent_path.clone());
std::fs::create_dir_all(parent_path)?;
std::fs::copy(args.path, &base_file)?;
let build_dir = args.path.parent().unwrap().join("tulflash");
let source_file_name = args.path.file_name().ok_or(Error::other("invalid path to compilation source"))?;
let source_file = build_dir.join(&source_file_name);
let output_file = source_file.with_extension("ihx");
let cmd = Some(OsString::from(format!("sdcc \"{}\"", source_file_name.to_string_lossy())));
let cmd_path = Some(build_dir.clone());
std::fs::create_dir_all(build_dir)?;
std::fs::copy(args.path, &source_file)?;
write_chip(ArgWrite {
path: path.into_os_string(),
path: output_file.into_os_string(),
cmd_path,
cmd,
start: 0,