improve reliability and logging when running into game access denied issues

This commit is contained in:
2025-09-09 03:03:32 +01:00
parent 356d5f17e5
commit f63d24ea43
3 changed files with 28 additions and 8 deletions
+10 -2
View File
@@ -1,4 +1,7 @@
use crate::util::consts::game::{EXE_ENHANCED, EXE_LEGACY};
use crate::util::{
consts::game::{EXE_ENHANCED, EXE_LEGACY},
log,
};
use std::time::{Duration, Instant};
use sysinfo::System;
@@ -58,7 +61,12 @@ fn activate(sysinfo: &mut System) {
.iter()
.filter(|(_, p)| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY)
.for_each(|(_, p)| {
p.kill();
if p.kill() == false {
log::log(
log::LogLevel::Error,
"failed to force close game, probably due to access denied",
);
}
});
sysinfo.refresh_all();
}