[feat] better installer + changelog test version switch + better video config view

This commit is contained in:
2025-11-05 11:19:43 +08:00
parent ea0a42dc43
commit 41008cf13c
19 changed files with 1499 additions and 183 deletions

View File

@@ -81,6 +81,40 @@ pub fn open_path(path: &str) -> Result<(), std::io::Error> {
Ok(())
}
pub fn check_process_running(name: &str) -> bool {
// 使用tasklist命令检查进程是否存在
#[cfg(windows)]
{
let output = Command::new("tasklist")
.args(&["/FI", &format!("IMAGENAME eq {}", name)])
.creation_flags(CREATE_NO_WINDOW)
.output();
if let Ok(output) = output {
let stdout = String::from_utf8_lossy(&output.stdout);
// 检查输出中是否包含进程名(排除表头)
stdout.contains(name) && stdout.contains("exe")
} else {
false
}
}
#[cfg(not(windows))]
{
// 对于非Windows系统可以使用ps命令
let output = Command::new("pgrep")
.arg("-f")
.arg(name)
.output();
if let Ok(output) = output {
!output.stdout.is_empty()
} else {
false
}
}
}
mod tests {
#[test]
fn test_open_path() {