diff --git a/plugins/fs-extra/src/lib.rs b/plugins/fs-extra/src/lib.rs index 286e8508..4bfabad2 100644 --- a/plugins/fs-extra/src/lib.rs +++ b/plugins/fs-extra/src/lib.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use serde::{ser::Serializer, Serialize}; -use tauri::{command, plugin::Plugin, Invoke, Runtime}; +use tauri::{command, plugin::{Builder as PluginBuilder, TauriPlugin}, Runtime}; use std::{ path::PathBuf, @@ -121,25 +121,8 @@ async fn exists(path: PathBuf) -> bool { path.exists() } -/// Tauri plugin. -pub struct FsExtra { - invoke_handler: Box) + Send + Sync>, -} - -impl Default for FsExtra { - fn default() -> Self { - Self { - invoke_handler: Box::new(tauri::generate_handler![exists, metadata]), - } - } -} - -impl Plugin for FsExtra { - fn name(&self) -> &'static str { - "fs-extra" - } - - fn extend_api(&mut self, message: Invoke) { - (self.invoke_handler)(message) - } -} +pub fn init() -> TauriPlugin { + PluginBuilder::new("fs-extra") + .invoke_handler(tauri::generate_handler![exists, metadata]) + .build() +} \ No newline at end of file