Add live process game detection

This commit is contained in:
Alvin-Zilverstand committed 2026-09-09 10:45:52 +02:00
1 parent af3e6c28e5
commit 3085012ab1
4 files changed
+72

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
use crate::game_detection::RunningProcess;
use sysinfo::System;
pub fn running_processes() -> Vec<RunningProcess> {
let mut system = System::new_all();
system.refresh_all();
system
.processes()
.iter()
.map(|(pid, process)| RunningProcess {
pid: pid.as_u32(),
process_name: process.name().to_string_lossy().to_string(),
executable_path: process
.exe()
.map(|path| path.display().to_string())
.unwrap_or_default(),
window_title: None,
})
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn process_snapshot_is_available() {
let processes = running_processes();
assert!(!processes.is_empty());
}
}