Aliases in mimeapps.list

David Faure faure at kde.org
Tue Mar 2 02:08:43 PST 2010


On Tuesday 02 March 2010, Alexander Larsson wrote:
> On Mon, 2010-03-01 at 19:12 +0100, David Faure wrote:
> > Hi Alexander,
> > 
> > [sorry for resending, CC was wrong in first email]
> > 
> > I have a question: how do you handle aliases in mimeapps.list?
> > If someone writes
> > application/pdf=app1.desktop;app2.desktop;
> > application/x-pdf=app2.desktop;app3.desktop;
> > and given that x-pdf is an alias for pdf, what happens?
> > 
> > AFAICS the only solution is to ignore lines about aliases,
> > and only write down associations for the "real" mimetype, right?
> 
> Actually, what we currently do is unalias each type in the mimeapps.list
> file as we read it, so in the above example the second line would
> override the first.

OK, good to know.

> However, i don't think we ever produce mimeapps.list files with aliased
> mimetypes, since all mimetypes that appear in the UI and such are
> unaliased first. So, the only way to get such a file would be to edit it
> manually.

Not necessarily. It can also happen when a newer version of shared-mime-info 
replaces a mimetype with an alias, as happened in 7b6a1ae8 (a year ago), where
image/x-ico was removed as a mimetype and made an alias for 
image/vnd.microsoft.icon.
When this kind of change happens, users who had settings for the mimetype in 
mimeapps.list end up with settings for an alias, without ever editing the file 
by hand. Corner case, I agree, but it's good to handle it correctly 
nonetheless. Your approach of un-aliasing the mimetype name handles this 
correctly IMHO, so I'll do that too.

Of course this means we can end up with "conflicting" lines in mimeapps.list, 
e.g. if the GUI writes the new mimetype name and leaves the line with the 
alias unchanged, but that alias line is still being read and (depending on 
order) overrides the new mimetype settings... That would be bad ;)
I guess we have to remove aliases from mimeapps.list when rewriting the file 
from the GUI...

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).


More information about the xdg mailing list