mirror of
https://github.com/chmln/handlr.git
synced 2024-11-14 21:49:27 +01:00
parent
513d68d1bd
commit
e86d7dd316
1 changed files with 19 additions and 12 deletions
|
@ -165,6 +165,9 @@ impl MimeApps {
|
|||
xdg::BaseDirectories::new()?
|
||||
.list_data_files_once("applications")
|
||||
.into_iter()
|
||||
.filter(|p| {
|
||||
p.extension().map(|x| x.to_str()).flatten() == Some("desktop")
|
||||
})
|
||||
.filter_map(|p| DesktopEntry::try_from(p).ok())
|
||||
.for_each(|e| {
|
||||
stdout.write_all(e.file_name.as_bytes()).unwrap();
|
||||
|
@ -201,11 +204,15 @@ impl SystemApps {
|
|||
})
|
||||
.filter_map(|data_dir| std::fs::read_dir(data_dir).ok())
|
||||
.for_each(|dir| {
|
||||
dir.filter_map(|path| {
|
||||
path.ok()
|
||||
.map(|p| DesktopEntry::try_from(p.path()).ok())
|
||||
dir.filter_map(Result::ok)
|
||||
.filter(|p| {
|
||||
p.path()
|
||||
.extension()
|
||||
.map(std::ffi::OsStr::to_str)
|
||||
.flatten()
|
||||
== Some("desktop")
|
||||
})
|
||||
.filter_map(|p| DesktopEntry::try_from(p.path()).ok())
|
||||
.for_each(|entry| {
|
||||
let (file_name, mimes) = (entry.file_name, entry.mimes);
|
||||
mimes.into_iter().for_each(|mime| {
|
||||
|
|
Loading…
Reference in a new issue