From 0d9d00babae5ca6a429fc146007521d5dea69a1a Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 13 May 2022 17:56:36 +0800 Subject: [PATCH] remove echo, https://github.com/rustdesk/rustdesk/issues/504 --- src/platform/windows.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 3b959015c..e398a7b1b 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -781,13 +781,9 @@ fn get_default_install_info() -> (String, String, String, String) { fn get_default_install_path() -> String { let mut pf = "C:\\Program Files".to_owned(); - if let Ok(output) = std::process::Command::new("echo") - .arg("%ProgramFiles%") - .output() - { - let tmp = String::from_utf8_lossy(&output.stdout); - if !tmp.starts_with("%") { - pf = tmp.to_string(); + if let Ok(x) = std::env::var("ProgramFiles") { + if std::path::Path::new(&x).exists() { + pf = x; } } #[cfg(target_pointer_width = "32")] @@ -1334,4 +1330,4 @@ pub fn get_win_key_state() -> bool { pub fn quit_gui() { unsafe { PostQuitMessage(0) }; -} \ No newline at end of file +}