[BE][Scans] Fixes #35. Rename file when there's an error detecting a QR
This commit is contained in:
parent
78ddd5a1f9
commit
99b02f30a2
@ -212,7 +212,19 @@ fn get_image_info(path: PathBuf) -> ScanInfo {
|
|||||||
Err(reason) => {
|
Err(reason) => {
|
||||||
log::error!("Error decoding qr: {:?}", reason);
|
log::error!("Error decoding qr: {:?}", reason);
|
||||||
// Here there was a problem aligning the QR. Assume no QR
|
// Here there was a problem aligning the QR. Assume no QR
|
||||||
return ScanInfo::Empty(current_ms.to_string());
|
|
||||||
|
// Rename the file
|
||||||
|
let mut new_path = path.clone();
|
||||||
|
new_path.set_file_name(format!("eeg_{}.jpg", current_ms));
|
||||||
|
|
||||||
|
return match fs::rename(path, new_path) {
|
||||||
|
Ok(_) => ScanInfo::Empty(current_ms.to_string()),
|
||||||
|
Err(err) => {
|
||||||
|
log::error!("Error renombrando archivo: {:?}", err);
|
||||||
|
|
||||||
|
ScanInfo::Error("Error renombrando archivo.".into())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user