diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index a6f633424..105b8ff5e 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -1599,12 +1599,15 @@ fn on_window_event( WindowEvent::FileDrop(event) => match event { FileDropEvent::Hovered(paths) => window.emit(WINDOW_FILE_DROP_HOVER_EVENT, paths)?, FileDropEvent::Dropped(paths) => { - let scopes = window.state::(); - for path in paths { - if path.is_file() { - let _ = scopes.allow_file(path); - } else { - let _ = scopes.allow_directory(path, false); + #[cfg(feature = "protocol-asset")] + { + let scopes = window.state::(); + for path in paths { + if path.is_file() { + let _ = scopes.asset_protocol.allow_file(path); + } else { + let _ = scopes.asset_protocol.allow_directory(path, false); + } } } window.emit(WINDOW_FILE_DROP_EVENT, paths)? diff --git a/core/tauri/src/scope/mod.rs b/core/tauri/src/scope/mod.rs index 19d188539..ff09633fd 100644 --- a/core/tauri/src/scope/mod.rs +++ b/core/tauri/src/scope/mod.rs @@ -8,26 +8,9 @@ pub mod ipc; pub use self::ipc::Scope as IpcScope; pub use fs::{Event as FsScopeEvent, Pattern as GlobPattern, Scope as FsScope}; -use std::path::Path; pub(crate) struct Scopes { pub ipc: IpcScope, #[cfg(feature = "protocol-asset")] pub asset_protocol: FsScope, } - -impl Scopes { - #[allow(dead_code, unused)] - pub(crate) fn allow_directory(&self, path: &Path, recursive: bool) -> crate::Result<()> { - #[cfg(feature = "protocol-asset")] - self.asset_protocol.allow_directory(path, recursive)?; - Ok(()) - } - - #[allow(dead_code, unused)] - pub(crate) fn allow_file(&self, path: &Path) -> crate::Result<()> { - #[cfg(feature = "protocol-asset")] - self.asset_protocol.allow_file(path)?; - Ok(()) - } -}