Skip to content

Commit

Permalink
fix(opener): Try /usr/bin/xdg-open first
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars committed Nov 26, 2024
1 parent 3fa0fc0 commit bf3e8a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/opener/src/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ use std::{ffi::OsStr, path::Path};
pub(crate) fn open<P: AsRef<OsStr>, S: AsRef<str>>(path: P, with: Option<S>) -> crate::Result<()> {
match with {
Some(program) => ::open::with_detached(path, program.as_ref()),
None => ::open::that_detached(path),
None => {
// ref https://github.com/tauri-apps/tauri/issues/10617
#[cfg(target_os = "linux")]
return ::open::with_detached(&path, "/usr/bin/xdg-open")
.or_else(|_| ::open::that_detached(path));
#[cfg(not(target_os = "linux"))]
::open::that_detached(path)
}
}
.map_err(Into::into)
}
Expand Down

0 comments on commit bf3e8a0

Please sign in to comment.