diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 190834eb8..a77b92e07 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -839,6 +839,11 @@ pub fn check_update_broker_process() -> ResultType<()> { let cur_dir = exe_file.parent().unwrap(); let cur_exe = cur_dir.join(process_exe); + if !std::path::Path::new(&cur_exe).exists() { + std::fs::copy(origin_process_exe, cur_exe)?; + return Ok(()); + } + let ori_modified = fs::metadata(origin_process_exe)?.modified()?; if let Ok(metadata) = fs::metadata(&cur_exe) { if let Ok(cur_modified) = metadata.modified() { diff --git a/src/server/connection.rs b/src/server/connection.rs index cd5bd8cfa..c8814a3b1 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -1274,7 +1274,7 @@ impl Connection { .retain(|_, v| v.0.elapsed() < SWITCH_SIDES_TIMEOUT); let uuid_old = SWITCH_SIDES_UUID.lock().unwrap().remove(&lr.my_id); if let Ok(uuid) = uuid::Uuid::from_slice(_s.uuid.to_vec().as_ref()) { - if let Some((instant, uuid_old)) = uuid_old { + if let Some((_instant, uuid_old)) = uuid_old { if uuid == uuid_old { self.from_switch = true; self.try_start_cm(lr.my_id.clone(), lr.my_name.clone(), true); diff --git a/src/ui_cm_interface.rs b/src/ui_cm_interface.rs index ea3553c8a..d620bcbc9 100644 --- a/src/ui_cm_interface.rs +++ b/src/ui_cm_interface.rs @@ -449,14 +449,11 @@ pub async fn start_ipc(cm: ConnectionManager) { #[cfg(windows)] std::thread::spawn(move || { log::info!("try create privacy mode window"); - #[cfg(windows)] - { - if let Err(e) = crate::platform::windows::check_update_broker_process() { - log::warn!( - "Failed to check update broker process. Privacy mode may not work properly. {}", - e - ); - } + if let Err(e) = crate::platform::windows::check_update_broker_process() { + log::warn!( + "Failed to check update broker process. Privacy mode may not work properly. {}", + e + ); } allow_err!(crate::ui::win_privacy::start()); });