version 1.0.1 of xdg-mime doesn't check defaults.list correctly : it searchs for the first .desktop keyfile for a particular mimetype, without checking if this .desktop is available on the system. The attached patch fixes this issue. It isn't perfect, since xdg-mime doesn't checks if .desktop if valid (ie if Exec= is pointing to a existing executable file) or if it can be used (ie not in Hidden=true) but it is better.
Created attachment 8786 [details] [review] check .desktop file from defaults.list exists
The patch doesn't really improve things because now it will fail telling you about certain applications that are default but that have their *.desktop file installed in a location outside $XDG_DATA_DIRS/applications that's explicitly included in /etc/xorg/menus/applications.menu The current version at least guarantees that after xdg-mime default FOO.desktop mime/type a following xdg-mime query default mime/type will always return FOO.desktop We really need an application like ktradertest that takes the full spec into account, would be nice if gnomevfs had something similar.
I propose gnomevfs-default along the lines of: main(argc, argv) { GnomeVFSMimeApplication *app; const char *desktop_id; if (!argc) { printf("Usage: gnomevfs-default <mimetype>\n"); return 2; } app = gnome_vfs_mime_get_default_application(argv[1]); if (!app) return 1; desktop_id = gnome_vfs_mime_application_get_desktop_id(app); if (!desktop_id) return 1; printf("%s\n", desktop_id); return 0; }
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/17.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.