From a843888cb855d6defe1d2a80d7b67bda4ec4fe25 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Wed, 27 Jul 2022 17:01:55 -0700 Subject: [PATCH] cleanup --- src-tauri/src/file_helpers.rs | 9 ++++++++- src-tauri/src/metadata_patcher.rs | 3 +-- src-tauri/src/unzip.rs | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/file_helpers.rs b/src-tauri/src/file_helpers.rs index c752492..b0d7987 100644 --- a/src-tauri/src/file_helpers.rs +++ b/src-tauri/src/file_helpers.rs @@ -18,7 +18,14 @@ pub fn rename(path: String, new_name: String) { let path_replaced = &path.replace(&new_path.split('/').last().unwrap(), &new_name); - fs::rename(path, &path_replaced).unwrap(); + match fs::rename(&path, &path_replaced) { + Ok(_) => { + println!("Renamed {} to {}", &path, path_replaced); + } + Err(e) => { + println!("Error: {}", e); + } + }; } #[tauri::command] diff --git a/src-tauri/src/metadata_patcher.rs b/src-tauri/src/metadata_patcher.rs index 9e0d0d1..0403454 100644 --- a/src-tauri/src/metadata_patcher.rs +++ b/src-tauri/src/metadata_patcher.rs @@ -145,6 +145,5 @@ fn encrypt_metadata(old_data: &[u8]) -> Vec { } fn do_vecs_match(a: &Vec, b: &Vec) -> bool { - let matching = a.iter().zip(b.iter()).filter(|&(a, b)| a == b).count(); - matching == a.len() && matching == b.len() + a == b } diff --git a/src-tauri/src/unzip.rs b/src-tauri/src/unzip.rs index 7920622..2680546 100644 --- a/src-tauri/src/unzip.rs +++ b/src-tauri/src/unzip.rs @@ -63,7 +63,7 @@ pub fn unzip( println!("Is rar file? {}", zipfile.ends_with(".rar")); - let mut name = "".into(); + let name; // If file ends in zip, OR is unknown, extract as zip, otherwise extract as rar if zipfile.ends_with(".rar") {