add more browser paths
This commit is contained in:
@@ -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)]
|
||||
pub struct BrowserProfile {
|
||||
pub name: String,
|
||||
@@ -416,9 +424,8 @@ pub async fn run_browser_scan(browser: BrowserType) -> Result<BrowserScanResult,
|
||||
|
||||
if profile_path.exists() {
|
||||
let mut size = 0;
|
||||
// 扫描常见的缓存目录
|
||||
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() {
|
||||
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 {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user