From 5ab0f499ce96ed8f30b8cf85e66d3fd5190b62f7 Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 27 Oct 2023 20:57:35 +0800 Subject: [PATCH] fix build Signed-off-by: fufesou --- libs/virtual_display/dylib/src/lib.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libs/virtual_display/dylib/src/lib.rs b/libs/virtual_display/dylib/src/lib.rs index 51a8d66ea..573c51810 100644 --- a/libs/virtual_display/dylib/src/lib.rs +++ b/libs/virtual_display/dylib/src/lib.rs @@ -1,8 +1,9 @@ #[cfg(windows)] pub mod win10; +use hbb_common::ResultType; +#[cfg(windows)] +use hbb_common::{bail, lazy_static}; #[cfg(windows)] -use hbb_common::lazy_static; -use hbb_common::{bail, ResultType}; use std::path::PathBuf; #[cfg(windows)] @@ -33,12 +34,9 @@ pub fn download_driver() -> ResultType<()> { Ok(()) } +#[cfg(windows)] fn get_driver_install_abs_path() -> ResultType { - #[cfg(windows)] let install_path = win10::DRIVER_INSTALL_PATH; - #[cfg(not(windows))] - bail!("Not implemented for non-windows"); - let exe_file = std::env::current_exe()?; let abs_path = match exe_file.parent() { Some(cur_dir) => cur_dir.join(install_path), @@ -55,8 +53,6 @@ fn get_driver_install_abs_path() -> ResultType { #[no_mangle] pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> { - let abs_path = get_driver_install_abs_path()?; - #[cfg(windows)] unsafe { { @@ -66,6 +62,7 @@ pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> { bail!("{}", e); } + let abs_path = get_driver_install_abs_path()?; let full_install_path: Vec = abs_path .to_string_lossy() .as_ref() @@ -88,11 +85,10 @@ pub fn install_update_driver(_reboot_required: &mut bool) -> ResultType<()> { #[no_mangle] pub fn uninstall_driver(_reboot_required: &mut bool) -> ResultType<()> { - let abs_path = get_driver_install_abs_path()?; - #[cfg(windows)] unsafe { { + let abs_path = get_driver_install_abs_path()?; let full_install_path: Vec = abs_path .to_string_lossy() .as_ref()