Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/fix-deep-link-semver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
deep-link: patch
deep-link-js: patch
---

Revert the breaking change introduced by [#2928](https://github.com/tauri-apps/plugins-workspace/pull/2928).
13 changes: 10 additions & 3 deletions plugins/deep-link/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ pub enum Error {
#[cfg(target_os = "linux")]
#[error(transparent)]
ParseIni(#[from] ini::ParseError),
#[cfg(target_os = "linux")]
#[error("Failed to run OS command `{0}`: {1}")]
Execute(&'static str, #[source] std::io::Error),
#[cfg(mobile)]
#[error(transparent)]
PluginInvoke(#[from] tauri::plugin::mobile::PluginInvokeError),
}

// TODO(v3): change this into an error in v3,
// see <https://github.com/tauri-apps/plugins-workspace/pull/2970#issuecomment-3244660138>.
#[inline]
#[cfg(target_os = "linux")]
pub(crate) fn inspect_command_error<'a>(command: &'a str) -> impl Fn(&std::io::Error) + 'a {
move |e| {
tracing::error!("Failed to run OS command `{command}`: {e}");
}
}

impl Serialize for Error {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
Expand Down
8 changes: 5 additions & 3 deletions plugins/deep-link/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,14 @@ mod imp {
Command::new("update-desktop-database")
.arg(target)
.status()
.map_err(|error| crate::Error::Execute("update-desktop-database", error))?;
.inspect_err(crate::error::inspect_command_error(
"update-desktop-database",
))?;

Command::new("xdg-mime")
.args(["default", &file_name, mime_type.as_str()])
.status()
.map_err(|error| crate::Error::Execute("xdg-mime", error))?;
.inspect_err(crate::error::inspect_command_error("xdg-mime"))?;

Ok(())
}
Expand Down Expand Up @@ -444,7 +446,7 @@ mod imp {
&format!("x-scheme-handler/{}", _protocol.as_ref()),
])
.output()
.map_err(|error| crate::Error::Execute("xdg-mime", error))?;
.inspect_err(crate::error::inspect_command_error("xdg-mime"))?;

Ok(String::from_utf8_lossy(&output.stdout).contains(&file_name))
}
Expand Down
Loading