mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
chore: edition 2024
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{command, Manager, Runtime, State, Window};
|
||||
use tauri::{Manager, Runtime, State, Window, command};
|
||||
use tauri_plugin_fs::FsExt;
|
||||
|
||||
use crate::{
|
||||
@@ -171,14 +171,13 @@ pub(crate) async fn open<R: Runtime>(
|
||||
)
|
||||
} else {
|
||||
let folder = dialog_builder.blocking_pick_folder();
|
||||
if let Some(folder) = &folder {
|
||||
if let Ok(path) = folder.clone().into_path() {
|
||||
if let Some(folder) = &folder
|
||||
&& let Ok(path) = folder.clone().into_path() {
|
||||
if let Some(s) = window.try_fs_scope() {
|
||||
s.allow_directory(&path, options.recursive)?;
|
||||
}
|
||||
tauri_scope.allow_directory(&path, options.directory)?;
|
||||
}
|
||||
}
|
||||
OpenResponse::Folder(folder.map(|p| p.simplified()))
|
||||
}
|
||||
}
|
||||
@@ -204,14 +203,13 @@ pub(crate) async fn open<R: Runtime>(
|
||||
let tauri_scope = window.state::<tauri::scope::Scopes>();
|
||||
let file = dialog_builder.blocking_pick_file();
|
||||
|
||||
if let Some(file) = &file {
|
||||
if let Ok(path) = file.clone().into_path() {
|
||||
if let Some(file) = &file
|
||||
&& let Ok(path) = file.clone().into_path() {
|
||||
if let Some(s) = window.try_fs_scope() {
|
||||
s.allow_file(&path)?;
|
||||
}
|
||||
tauri_scope.allow_file(&path)?;
|
||||
}
|
||||
}
|
||||
OpenResponse::File(file.map(|f| f.simplified()))
|
||||
};
|
||||
Ok(res)
|
||||
@@ -246,14 +244,13 @@ pub(crate) async fn save<R: Runtime>(
|
||||
let tauri_scope = window.state::<tauri::scope::Scopes>();
|
||||
|
||||
let path = dialog_builder.blocking_save_file();
|
||||
if let Some(p) = &path {
|
||||
if let Ok(path) = p.clone().into_path() {
|
||||
if let Some(p) = &path
|
||||
&& let Ok(path) = p.clone().into_path() {
|
||||
if let Some(s) = window.try_fs_scope() {
|
||||
s.allow_file(&path)?;
|
||||
}
|
||||
tauri_scope.allow_file(&path)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(path.map(|p| p.simplified()))
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle, RawDisplayHandle, RawWindowHandle};
|
||||
use rfd::{AsyncFileDialog, AsyncMessageDialog};
|
||||
use serde::de::DeserializeOwned;
|
||||
use tauri::{plugin::PluginApi, AppHandle, Runtime};
|
||||
use tauri::{AppHandle, Runtime, plugin::PluginApi};
|
||||
|
||||
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder};
|
||||
use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder, models::*};
|
||||
|
||||
pub fn init<R: Runtime, C: DeserializeOwned>(
|
||||
app: &AppHandle<R>,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{ser::Serializer, Serialize};
|
||||
use serde::{Serialize, ser::Serializer};
|
||||
|
||||
/// Alias for `Result<T, Error>` used throughout this crate.
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tauri::{
|
||||
plugin::{Builder, TauriPlugin},
|
||||
Manager, Runtime,
|
||||
plugin::{Builder, TauriPlugin},
|
||||
};
|
||||
|
||||
use std::{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use serde::{Deserialize, de::DeserializeOwned};
|
||||
use tauri::{
|
||||
plugin::{PluginApi, PluginHandle},
|
||||
AppHandle, Runtime,
|
||||
plugin::{PluginApi, PluginHandle},
|
||||
};
|
||||
|
||||
use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder, MessageDialogResult};
|
||||
|
||||
Reference in New Issue
Block a user