Skip to content

Commit

Permalink
feat: added change saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Tormak9970 committed Mar 29, 2023
1 parent dae58e4 commit 9ca2102
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
File renamed without changes.
12 changes: 7 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ async fn save_changes(app_handle: AppHandle, current_art: String, original_art:

for (key, value) in current_art_dict.into_iter() {
for (sub_key, sub_value) in value.into_iter() {
let original_val: String = original_art_dict.get(key.as_str()).unwrap().get(sub_key.as_str()).unwrap().to_owned();
if original_val != sub_value {
let copy_res = fs::copy(sub_value, original_val);
let original_value: &String = original_art_dict.get(key.as_str()).unwrap().get(sub_key.as_str()).unwrap();
let original_val = original_value.to_owned();
let sub_val = sub_value.to_owned();
if original_val != sub_val {
let copy_res = fs::copy(sub_value, original_value);
if copy_res.is_ok() {
logger::log_to_file(app_handle.to_owned(), format!("Copied {} to {}.", sub_value, original_val).as_str(), 0);
logger::log_to_file(app_handle.to_owned(), format!("Copied {} to {}.", sub_val, original_val).as_str(), 0);
} else {
logger::log_to_file(app_handle.to_owned(), format!("Failed to copy {} to {}.", sub_value, original_val).as_str(), 2);
logger::log_to_file(app_handle.to_owned(), format!("Failed to copy {} to {}.", sub_val, original_val).as_str(), 2);
return false;
}
}
Expand Down

0 comments on commit 9ca2102

Please sign in to comment.