diff --git a/src/features/game_networking.rs b/src/features/game_networking.rs index 31e85c8..26ea98d 100644 --- a/src/features/game_networking.rs +++ b/src/features/game_networking.rs @@ -1,14 +1,5 @@ -use crate::{ - gui::settings::BlockMethod, - util::{ - consts::game::{EXE_ENHANCED, EXE_LEGACY}, - system_info::SystemInfo, - }, -}; -use std::{ - error::Error, - path::{Path, PathBuf}, -}; +use crate::{gui::settings::BlockMethod, util::system_info::SystemInfo}; +use std::{error::Error, path::PathBuf}; use windows::{ Win32::{ NetworkManagement::WindowsFirewall::{ @@ -159,12 +150,3 @@ impl GameNetworking { Ok(()) } } - -fn get_game_exe_path(system_info: &mut SystemInfo) -> Option<&Path> { - system_info.refresh(); - system_info - .processes() - .iter() - .find(|p| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY) - .and_then(|p| p.exe()) -} diff --git a/src/util/system_info.rs b/src/util/system_info.rs index a01ae97..148a43e 100644 --- a/src/util/system_info.rs +++ b/src/util/system_info.rs @@ -18,6 +18,8 @@ use windows::{ core::PWSTR, }; +use crate::util::consts::game::{EXE_ENHANCED, EXE_LEGACY}; + #[derive(Clone, Debug)] pub struct Process { pid: u32, @@ -80,6 +82,14 @@ impl SystemInfo { self.processes = processes; } + pub fn get_game_exe_path(&mut self) -> Option<&Path> { + self.refresh(); + self.processes() + .iter() + .find(|p| p.name() == EXE_ENHANCED || p.name() == EXE_LEGACY) + .and_then(|p| p.exe()) + } + pub fn processes(&self) -> &[Process] { &self.processes }