add more browser paths

This commit is contained in:
Julian Freeman
2026-03-03 17:46:01 -04:00
parent 6a61e36c21
commit 5cd6210dd2

View File

@@ -368,6 +368,14 @@ fn clean_directory_contents(path: &Path, filter_days: Option<u64>) -> (u64, u32,
// --- 浏览器清理逻辑 --- // --- 浏览器清理逻辑 ---
const BROWSER_CACHE_DIRS: &[&str] = &[
"Cache",
"Code Cache",
"GPUCache",
"Media Cache",
"Service Worker/CacheStorage"
];
#[derive(Serialize, Clone)] #[derive(Serialize, Clone)]
pub struct BrowserProfile { pub struct BrowserProfile {
pub name: String, pub name: String,
@@ -416,9 +424,8 @@ pub async fn run_browser_scan(browser: BrowserType) -> Result<BrowserScanResult,
if profile_path.exists() { if profile_path.exists() {
let mut size = 0; let mut size = 0;
// 扫描常见的缓存目录 // 扫描配置的缓存目录
let cache_dirs = ["Cache", "Code Cache", "GPUCache", "Media Cache"]; for sub in BROWSER_CACHE_DIRS {
for sub in cache_dirs {
let target = profile_path.join(sub); let target = profile_path.join(sub);
if target.exists() { if target.exists() {
size += get_dir_size_simple(&target); size += get_dir_size_simple(&target);
@@ -461,8 +468,8 @@ pub async fn run_browser_clean(browser: BrowserType, profile_paths: Vec<String>)
for profile_dir in profile_paths { for profile_dir in profile_paths {
let profile_path = user_data_path.join(&profile_dir); let profile_path = user_data_path.join(&profile_dir);
if profile_path.exists() { 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); let target = profile_path.join(sub);
if target.exists() { if target.exists() {
let (f, s, fl) = clean_directory_contents(&target, None); let (f, s, fl) = clean_directory_contents(&target, None);