Ver Fonte

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

Lucas Fernandes Nogueira há 4 anos atrás
pai
commit
49fb3b7225
2 ficheiros alterados com 8 adições e 3 exclusões
  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 {
   hwnd: *mut std::ffi::c_void,
 }
 
-#[cfg(windows)]
+#[cfg(all(windows, any(dialog_open, dialog_save)))]
 unsafe impl raw_window_handle::HasRawWindowHandle for WindowParent {
   fn raw_window_handle(&self) -> raw_window_handle::RawWindowHandle {
     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> {
   Ok(WindowParent {
     hwnd: window.hwnd()?,