feat: kill clash by pid

This commit is contained in:
GyDi
2022-09-05 16:30:29 +08:00
committed by GitHub
parent 7f0a04e3e3
commit 000d6ebcd0
5 changed files with 109 additions and 2 deletions

View File

@@ -15,7 +15,6 @@ static VERGE_CONFIG: &str = "verge.yaml";
static PROFILE_YAML: &str = "profiles.yaml";
static PROFILE_TEMP: &str = "clash-verge-runtime.yaml";
#[cfg(windows)]
static mut RESOURCE_DIR: Option<PathBuf> = None;
/// portable flag
@@ -65,7 +64,6 @@ pub fn app_resources_dir(package_info: &PackageInfo) -> PathBuf {
.unwrap()
.join("resources");
#[cfg(windows)]
unsafe {
RESOURCE_DIR = Some(res_dir.clone());
}
@@ -103,6 +101,10 @@ pub fn profiles_temp_path() -> PathBuf {
return app_home_dir().join(PROFILE_TEMP);
}
pub fn clash_pid_path() -> PathBuf {
unsafe { RESOURCE_DIR.clone().unwrap().join("clash.pid") }
}
#[cfg(windows)]
static SERVICE_PATH: &str = "clash-verge-service.exe";