From b81c7fd8631b0733355e73b82c5514ec889c40f0 Mon Sep 17 00:00:00 2001 From: funman300 Date: Sun, 19 Apr 2026 00:53:36 -0700 Subject: [PATCH] detect: filter out launcher tools and non-game exes from game scan --- src/detect.rs | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/src/detect.rs b/src/detect.rs index a7686b6..f029191 100644 --- a/src/detect.rs +++ b/src/detect.rs @@ -51,6 +51,62 @@ const SYSTEM_DIRS: &[&str] = &[ "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. /// Returns (display_name, path_relative_to_drive_c) pairs, sorted alphabetically, /// 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)) { continue; } + if SKIP_DIRS.iter().any(|s| lower == *s) { + continue; + } if path.is_dir() { scan_exe_dir(&path, drive_c, launcher_exe, already, out, seen, depth + 1); } else if path @@ -116,6 +175,15 @@ fn scan_exe_dir( if rel_lower == launcher_exe || already.contains(&rel_lower) { 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) { continue; }