detect: filter out launcher tools and non-game exes from game scan

This commit is contained in:
funman300
2026-04-19 00:53:36 -07:00
parent a1afa59f1a
commit b81c7fd863
+68
View File
@@ -51,6 +51,62 @@ const SYSTEM_DIRS: &[&str] = &[
"windowsapps", "windowsapps",
]; ];
/// Directory names that contain launcher infrastructure, not games.
const SKIP_DIRS: &[&str] = &[
"battle.net",
"electronic arts",
"ea desktop",
"epic games",
"gog galaxy",
"ubisoft",
"rockstar games",
"wine",
"mono",
"gecko",
];
/// Exe filename patterns that are launcher tools, not games.
const SKIP_EXES: &[&str] = &[
"uninstall",
"uninst",
"crash",
"reporter",
"update",
"updater",
"setup",
"installer",
"helper",
"agent",
"service",
"redist",
"vcredist",
"dxsetup",
"dxwebsetup",
"dotnetfx",
"vc_redist",
"bootstrapper",
"launcher", // launcher tools, not games
"battlenet",
"eadesktop",
"eabackgroundservice",
"ealink",
"epicgameslauncher",
"epicwebhelper",
"ubisoftconnect",
"ubisoftgamelauncher",
"upc",
"galaxyclient",
"galaxycommunication",
"galaxypeer",
"socialclubhelper",
"subprocess",
"cefprocess",
"webhelper",
"webview",
"7za",
"aria2c",
];
/// Scan a launcher's Wine prefix for installed game executables. /// Scan a launcher's Wine prefix for installed game executables.
/// Returns (display_name, path_relative_to_drive_c) pairs, sorted alphabetically, /// Returns (display_name, path_relative_to_drive_c) pairs, sorted alphabetically,
/// excluding the launcher's own exe and any already-configured games. /// excluding the launcher's own exe and any already-configured games.
@@ -102,6 +158,9 @@ fn scan_exe_dir(
if SYSTEM_DIRS.iter().any(|s| lower.starts_with(s)) { if SYSTEM_DIRS.iter().any(|s| lower.starts_with(s)) {
continue; continue;
} }
if SKIP_DIRS.iter().any(|s| lower == *s) {
continue;
}
if path.is_dir() { if path.is_dir() {
scan_exe_dir(&path, drive_c, launcher_exe, already, out, seen, depth + 1); scan_exe_dir(&path, drive_c, launcher_exe, already, out, seen, depth + 1);
} else if path } else if path
@@ -116,6 +175,15 @@ fn scan_exe_dir(
if rel_lower == launcher_exe || already.contains(&rel_lower) { if rel_lower == launcher_exe || already.contains(&rel_lower) {
continue; continue;
} }
// Skip launcher tools, updaters, and non-game executables
let stem_lower = path
.file_stem()
.and_then(|s| s.to_str())
.unwrap_or("")
.to_lowercase();
if SKIP_EXES.iter().any(|s| stem_lower.contains(s)) {
continue;
}
if !seen.insert(rel_lower) { if !seen.insert(rel_lower) {
continue; continue;
} }