kv-clearnup/backend/internal/scanner/targets_windows.go

90 lines
3 KiB
Go

package scanner
import (
"os"
"path/filepath"
)
func GetScanTargets(category string) []string {
home, _ := os.UserHomeDir()
switch category {
case "apps":
// Windows apps are dispersed (Program Files), usually read-only. We don't file-scan them usually.
return []string{
os.Getenv("ProgramFiles"),
os.Getenv("ProgramFiles(x86)"),
filepath.Join(os.Getenv("LocalAppData"), "Programs"),
}
case "photos":
return []string{filepath.Join(home, "Pictures")}
case "icloud":
// iCloudDrive?
return []string{filepath.Join(home, "iCloudDrive")}
case "docs":
return []string{filepath.Join(home, "Documents")}
case "downloads":
return []string{filepath.Join(home, "Downloads")}
case "desktop":
return []string{filepath.Join(home, "Desktop")}
case "music":
return []string{filepath.Join(home, "Music")}
case "movies":
return []string{filepath.Join(home, "Videos")}
case "system":
return []string{
filepath.Join(home, "AppData", "Local", "Temp"),
filepath.Join(home, "AppData", "Local", "Microsoft", "Windows", "INetCache"), // IE/Edge cache
filepath.Join(home, "AppData", "Local", "Google", "Chrome", "User Data", "Default", "Cache"),
filepath.Join(home, "AppData", "Local", "Mozilla", "Firefox", "Profiles"),
filepath.Join(home, "AppData", "Local", "BraveSoftware", "Brave-Browser", "User Data", "Default", "Cache"),
filepath.Join(home, "AppData", "Local", "Opera Software", "Opera Stable", "Cache"),
}
case "cache":
return []string{
os.Getenv("TEMP"),
filepath.Join(home, "AppData", "Local", "Temp"),
filepath.Join(home, "AppData", "Local", "Microsoft", "Windows", "INetCache"),
filepath.Join(home, "AppData", "Local", "Google", "Chrome", "User Data", "Default", "Cache"),
filepath.Join(home, "AppData", "Local", "Mozilla", "Firefox", "Profiles"),
filepath.Join(home, "AppData", "Local", "BraveSoftware", "Brave-Browser", "User Data", "Default", "Cache"),
filepath.Join(home, "AppData", "Local", "Opera Software", "Opera Stable", "Cache"),
}
case "games":
return []string{
`C:\Program Files (x86)\Steam\steamapps\common`,
`C:\Program Files\Epic Games`,
`C:\Program Files (x86)\Ubisoft\Ubisoft Game Launcher\games`,
`C:\Program Files\EA Games`,
filepath.Join(home, "AppData", "Roaming", ".minecraft"),
}
case "ai":
return []string{
`C:\ComfyUI`,
`C:\ai\ComfyUI`,
filepath.Join(home, "ComfyUI"),
filepath.Join(home, "stable-diffusion-webui"),
filepath.Join(home, "webui"),
filepath.Join(home, ".cache", "huggingface"),
filepath.Join(home, ".ollama", "models"),
filepath.Join(home, ".lmstudio", "models"),
}
case "docker":
return []string{
filepath.Join(os.Getenv("LocalAppData"), "Docker", "wsl", "data"),
}
case "archives":
// Archives usually scattered, but main ones in Downloads
return []string{
filepath.Join(home, "Downloads"),
filepath.Join(home, "Documents"),
}
case "vms":
return []string{
filepath.Join(home, "Downloads"),
filepath.Join(home, "Documents"),
filepath.Join(home, "VirtualBox VMs"),
}
default:
return []string{}
}
}