6

I know that there are some files /etc/gnome/defaults.list that store mime associations and are in format that should make editing them possible.

But I am looking for a way that will handle at least one of following problems

  • this file is in format that is reasonable to parse. Still, using API that somebody made and hopefully tested will save some time and problems with bugs
  • it would be great to have API aware about location of that file depending on OS version, OS etc. Even crashing with "this is not supported" would be preferable to script editing something that is no longer used

I want to fully automate my installation of Ubuntu - setting file associations to correct one is intended to be part of that.

Even automated/semi-automated (like documentation) way to find place storing file associations would be welcome.

how can I change file association globally? mentions /usr/share/gnome/applications/defaults.list, /usr/share/applications/defaults.list and /usr/share/applications/mimeapps.list See also Which default.list should I modify for default applications and what are the differences between the two? (so I would prefer to automate at least locating the file)

3

xdg-mime(1) may be what you're looking for.

The man page for this command links to the MIME database specification at https://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/, and also the MIME applications associations specification at http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.