From a9e66360a919ac5d35b155633603a09e1bc71db9 Mon Sep 17 00:00:00 2001 From: Shinyzenith Date: Sun, 23 Jan 2022 19:24:45 +0530 Subject: [PATCH] [refactor] Do not hardcode executable path, use std::env::current_exe() instead --- src/server.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 4f0cdea..9822ca3 100644 --- a/src/server.rs +++ b/src/server.rs @@ -31,8 +31,7 @@ fn main() -> Result<(), Box> { sys.refresh_all(); for (pid, process) in sys.processes() { if pid.to_string() == swhkd_pid { - if process.exe() == Path::new("/usr/local/bin/swhks") { - // this is the test hunk + if process.exe() == env::current_exe().unwrap() { log::error!("Server is already running!"); exit(1); }