From 0d480cbea6415c42676a69e728894610433fa1e8 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 14 Sep 2023 12:25:44 -0500 Subject: [PATCH] adding some error handling --- src/rust/service_item_model.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rust/service_item_model.rs b/src/rust/service_item_model.rs index 5c3f35c..3a04629 100644 --- a/src/rust/service_item_model.rs +++ b/src/rust/service_item_model.rs @@ -517,10 +517,10 @@ mod service_item_model { let text_list = QList_QString::from(&item.text); let mut text_vec = Vec::::default(); - let flat_background_path = + let background_path = PathBuf::from(item.background.to_string()); let flat_background_name = - flat_background_path.file_name(); + &background_path.file_name(); let flat_background; match flat_background_name { Some(name) => { @@ -533,6 +533,12 @@ mod service_item_model { flat_background = ""; } } + let mut temp_bg_path = temp_dir.clone(); + temp_bg_path.push(flat_background); + match fs::copy(&background_path, temp_bg_path) { + Ok(s) => println!("Background file copied"), + _ => println!("Failed"), + } let flat_audio_path = PathBuf::from(item.audio.to_string());