mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-01-31 00:45:24 +01:00
fmt
This commit is contained in:
@@ -3,12 +3,9 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use tauri::{
|
||||
plugin::PluginApi,
|
||||
AppHandle, Runtime,
|
||||
};
|
||||
use tauri::{plugin::PluginApi, AppHandle, Runtime};
|
||||
|
||||
use crate::{FilePath, OpenOptions, models::*};
|
||||
use crate::{models::*, FilePath, OpenOptions};
|
||||
|
||||
const PLUGIN_IDENTIFIER: &str = "com.plugin.fs";
|
||||
|
||||
@@ -81,4 +78,3 @@ impl<R: Runtime> Fs<R> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1023,7 +1023,9 @@ pub fn stop_accessing_security_scoped_resource<R: Runtime>(
|
||||
SafeFilePath::Url(url) => FilePath::Url(url),
|
||||
SafeFilePath::Path(safe_path) => FilePath::Path(safe_path.as_ref().to_owned()),
|
||||
};
|
||||
webview.fs().stop_accessing_security_scoped_resource(file_path)?;
|
||||
webview
|
||||
.fs()
|
||||
.stop_accessing_security_scoped_resource(file_path)?;
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
@@ -1126,7 +1128,7 @@ pub fn resolve_path<R: Runtime>(
|
||||
if let SafeFilePath::Url(url) = &path {
|
||||
if url.scheme() == "file" {
|
||||
use objc2_foundation::{NSString, NSURL};
|
||||
|
||||
|
||||
let url_string = url.as_str();
|
||||
let url_nsstring = NSString::from_str(url_string);
|
||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use serde::de::DeserializeOwned;
|
||||
use tauri::{
|
||||
plugin::PluginApi,
|
||||
AppHandle, Runtime,
|
||||
};
|
||||
use tauri::{plugin::PluginApi, AppHandle, Runtime};
|
||||
|
||||
use crate::{FilePath, OpenOptions};
|
||||
|
||||
@@ -36,7 +33,7 @@ impl<R: Runtime> Fs<R> {
|
||||
// Handle security-scoped URLs on iOS
|
||||
let url_string = url.as_str();
|
||||
let url_nsstring = NSString::from_str(url_string);
|
||||
|
||||
|
||||
// Create NSURL from the URL string
|
||||
// URLWithString may return None for invalid URLs, but file:// URLs should be valid
|
||||
let ns_url = unsafe { NSURL::URLWithString(&url_nsstring) };
|
||||
@@ -52,14 +49,9 @@ impl<R: Runtime> Fs<R> {
|
||||
}
|
||||
|
||||
// Convert URL to path and open the file
|
||||
let path = url
|
||||
.to_file_path()
|
||||
.map_err(|_| {
|
||||
std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidInput,
|
||||
"invalid file URL",
|
||||
)
|
||||
})?;
|
||||
let path = url.to_file_path().map_err(|_| {
|
||||
std::io::Error::new(std::io::ErrorKind::InvalidInput, "invalid file URL")
|
||||
})?;
|
||||
std::fs::OpenOptions::from(opts).open(path)
|
||||
}
|
||||
FilePath::Url(_) => Err(std::io::Error::new(
|
||||
@@ -119,4 +111,3 @@ impl<R: Runtime> Fs<R> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,26 +19,26 @@ use tauri::{
|
||||
AppHandle, DragDropEvent, Manager, RunEvent, Runtime, WindowEvent,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod android;
|
||||
mod commands;
|
||||
mod config;
|
||||
#[cfg(desktop)]
|
||||
mod desktop;
|
||||
#[cfg(target_os = "android")]
|
||||
mod android;
|
||||
#[cfg(target_os = "ios")]
|
||||
mod ios;
|
||||
mod error;
|
||||
mod file_path;
|
||||
#[cfg(target_os = "ios")]
|
||||
mod ios;
|
||||
#[cfg(target_os = "android")]
|
||||
mod models;
|
||||
mod scope;
|
||||
#[cfg(feature = "watch")]
|
||||
mod watcher;
|
||||
|
||||
#[cfg(desktop)]
|
||||
pub use desktop::Fs;
|
||||
#[cfg(target_os = "android")]
|
||||
pub use android::Fs;
|
||||
#[cfg(desktop)]
|
||||
pub use desktop::Fs;
|
||||
#[cfg(target_os = "ios")]
|
||||
pub use ios::Fs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user