fix(opener): Try `/usr/bin/xdg-open` first

pull/2103/head
FabianLars 6 months ago
parent 3fa0fc09bb
commit bf3e8a0b8a
No known key found for this signature in database

@ -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)
}

Loading…
Cancel
Save