aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-03-26 01:25:10 +0100
committerGitHub <noreply@github.com>2023-03-26 00:25:10 +0000
commit673297bd93d9824400fda41158d0e457cf92adfa (patch)
treed051210f2f373f5bd527f42093c54eb2331f42d6 /src-tauri
parenta8c3c12361b66c7cc29937cfad9475db985a5d41 (diff)
downloadFlightCore-673297bd93d9824400fda41158d0e457cf92adfa.tar.gz
FlightCore-673297bd93d9824400fda41158d0e457cf92adfa.zip
fix: Adjust code for single iteration loop (#232)
* fix: Adjust code for single iteration loop `clippy` said this is way is better... * refactor: Implement more compact suggestion * refactor: Implement more compact suggestion
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/lib.rs25
1 files changed, 6 insertions, 19 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 26878866..e9791835 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -333,29 +333,16 @@ pub fn launch_northstar(
pub fn check_origin_running() -> bool {
let s = sysinfo::System::new_all();
- for _process in s.processes_by_name("Origin.exe") {
- // check here if this is your process
- // dbg!(process);
- // There's at least one Origin process, so we can launch
- return true;
- }
- // Alternatively, check for EA Desktop
- for _process in s.processes_by_name("EADesktop.exe") {
- // There's at least one EADesktop process, so we can launch
- return true;
- }
- false
+ s.processes_by_name("Origin.exe").next().is_some()
+ || s.processes_by_name("EADesktop.exe").next().is_some()
}
/// Checks if Northstar process is running
pub fn check_northstar_running() -> bool {
- let s = sysinfo::System::new_all();
- for _process in s.processes_by_name("NorthstarLauncher.exe") {
- // check here if this is your process
- // dbg!(process);
- return true;
- }
- false
+ sysinfo::System::new_all()
+ .processes_by_name("NorthstarLauncher.exe")
+ .next()
+ .is_some()
}
/// Helps with converting release candidate numbers which are different on Thunderstore