Skip to content

Commit bbe5646

Browse files
committed
fix(deep-link): check update-desktop-database existence before executing
On Linux, `update-desktop-database` (from `desktop-file-utils`) may not be installed, especially on KDE systems. Instead of failing with an IO error, log a warning when the command is not found and continue. Non-NotFound errors still propagate as before. Fixes #2265
1 parent d016a8a commit bbe5646

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

plugins/deep-link/src/lib.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,28 @@ mod imp {
348348
)?;
349349
}
350350

351-
Command::new("update-desktop-database")
351+
match Command::new("update-desktop-database")
352352
.arg(target)
353353
.status()
354-
.inspect_err(crate::error::inspect_command_error(
355-
"update-desktop-database",
356-
))?;
354+
{
355+
Ok(status) => {
356+
if !status.success() {
357+
tracing::warn!(
358+
"`update-desktop-database` exited with status {status}"
359+
);
360+
}
361+
}
362+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
363+
tracing::warn!(
364+
"`update-desktop-database` not found, skipping MIME database update. \
365+
Install `desktop-file-utils` to silence this warning."
366+
);
367+
}
368+
Err(e) => {
369+
tracing::error!("Failed to run `update-desktop-database`: {e}");
370+
return Err(e.into());
371+
}
372+
}
357373

358374
Command::new("xdg-mime")
359375
.args(["default", &file_name, mime_type.as_str()])

0 commit comments

Comments
 (0)