mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-26 21:41:48 +02:00
chore: fmt
This commit is contained in:
@@ -42,9 +42,7 @@ impl<R: Runtime> Fs<R> {
|
||||
match path.into() {
|
||||
FilePath::Url(u) => self
|
||||
.resolve_content_uri(u.to_string(), opts.android_mode())
|
||||
.map_err(|e| {
|
||||
std::io::Error::other(format!("failed to open file: {e}"))
|
||||
}),
|
||||
.map_err(|e| std::io::Error::other(format!("failed to open file: {e}"))),
|
||||
FilePath::Path(p) => {
|
||||
// tauri::utils::platform::resources_dir() returns a PathBuf with the Android asset URI prefix
|
||||
// we must resolve that file with the Android API
|
||||
@@ -52,9 +50,7 @@ impl<R: Runtime> Fs<R> {
|
||||
.is_ok()
|
||||
{
|
||||
self.resolve_content_uri(p.to_string_lossy(), opts.android_mode())
|
||||
.map_err(|e| {
|
||||
std::io::Error::other(format!("failed to open file: {e}"))
|
||||
})
|
||||
.map_err(|e| std::io::Error::other(format!("failed to open file: {e}")))
|
||||
} else {
|
||||
std::fs::OpenOptions::from(opts).open(p)
|
||||
}
|
||||
|
||||
@@ -191,9 +191,10 @@ impl FromStr for FilePath {
|
||||
type Err = Infallible;
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
if let Ok(url) = url::Url::from_str(s)
|
||||
&& url.scheme().len() != 1 {
|
||||
return Ok(Self::Url(url));
|
||||
}
|
||||
&& url.scheme().len() != 1
|
||||
{
|
||||
return Ok(Self::Url(url));
|
||||
}
|
||||
Ok(Self::Path(PathBuf::from(s)))
|
||||
}
|
||||
}
|
||||
@@ -202,9 +203,10 @@ impl FromStr for SafeFilePath {
|
||||
type Err = Error;
|
||||
fn from_str(s: &str) -> Result<Self> {
|
||||
if let Ok(url) = url::Url::from_str(s)
|
||||
&& url.scheme().len() != 1 {
|
||||
return Ok(Self::Url(url));
|
||||
}
|
||||
&& url.scheme().len() != 1
|
||||
{
|
||||
return Ok(Self::Url(url));
|
||||
}
|
||||
|
||||
SafePathBuf::new(s.into())
|
||||
.map(SafeFilePath::Path)
|
||||
|
||||
Reference in New Issue
Block a user