소스 검색

fix(core): build without dialog Cargo features (#1973)

Lucas Fernandes Nogueira 4 년 전
부모
커밋
49fb3b7225
2개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 0
      .changes/fix-dialog-allowlist..md
  2. 3 3
      core/tauri/src/endpoints/dialog.rs

+ 5 - 0
.changes/fix-dialog-allowlist..md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Fixes build without the dialog Cargo features.

+ 3 - 3
core/tauri/src/endpoints/dialog.rs

@@ -144,12 +144,12 @@ fn set_default_path(
   }
   }
 }
 }
 
 
-#[cfg(windows)]
+#[cfg(all(windows, any(dialog_open, dialog_save)))]
 struct WindowParent {
 struct WindowParent {
   hwnd: *mut std::ffi::c_void,
   hwnd: *mut std::ffi::c_void,
 }
 }
 
 
-#[cfg(windows)]
+#[cfg(all(windows, any(dialog_open, dialog_save)))]
 unsafe impl raw_window_handle::HasRawWindowHandle for WindowParent {
 unsafe impl raw_window_handle::HasRawWindowHandle for WindowParent {
   fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
   fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
     let mut handle = raw_window_handle::windows::WindowsHandle::empty();
     let mut handle = raw_window_handle::windows::WindowsHandle::empty();
@@ -158,7 +158,7 @@ unsafe impl raw_window_handle::HasRawWindowHandle for WindowParent {
   }
   }
 }
 }
 
 
-#[cfg(windows)]
+#[cfg(all(windows, any(dialog_open, dialog_save)))]
 fn parent<P: Params>(window: Window<P>) -> crate::Result<WindowParent> {
 fn parent<P: Params>(window: Window<P>) -> crate::Result<WindowParent> {
   Ok(WindowParent {
   Ok(WindowParent {
     hwnd: window.hwnd()?,
     hwnd: window.hwnd()?,