diff --git a/src-tauri/src/cleaner.rs b/src-tauri/src/cleaner.rs index 375be69..abff82f 100644 --- a/src-tauri/src/cleaner.rs +++ b/src-tauri/src/cleaner.rs @@ -368,6 +368,14 @@ fn clean_directory_contents(path: &Path, filter_days: Option) -> (u64, u32, // --- 浏览器清理逻辑 --- +const BROWSER_CACHE_DIRS: &[&str] = &[ + "Cache", + "Code Cache", + "GPUCache", + "Media Cache", + "Service Worker/CacheStorage" +]; + #[derive(Serialize, Clone)] pub struct BrowserProfile { pub name: String, @@ -416,9 +424,8 @@ pub async fn run_browser_scan(browser: BrowserType) -> Result) for profile_dir in profile_paths { let profile_path = user_data_path.join(&profile_dir); if profile_path.exists() { - let cache_dirs = ["Cache", "Code Cache", "GPUCache", "Media Cache"]; - for sub in cache_dirs { + // 清理配置的缓存目录 + for sub in BROWSER_CACHE_DIRS { let target = profile_path.join(sub); if target.exists() { let (f, s, fl) = clean_directory_contents(&target, None);