Case insensitive mimetype matching edge case

David Faure faure at kde.org
Wed Aug 19 01:02:53 PDT 2009


On Wednesday 19 August 2009, Alexander Larsson wrote:
> Ugh. Additionally we have to extend the mime.cache format more. Maybe we
> can solve this with a hack. What about this:
>
> All case insensitive globs are converted to lower case in the globs
> file. Glob lookup is done by first matching the real filename against
> the globs, then (on failure) convert the name to lower case and try
> again. This will result in a case insensitive match except for things
> marked as case sensitive that has at least one uppercase character.
>
> We can't do case-sensitive matching of only-lowercase globs, but we
> don't currently have any example of this in the databases.

But I do want to do one of those, to solve bug 22634: I want
   <glob pattern="core"/> to be case-sensitive="true".

How about a different hack:
we generate in globs2 two lines, in case of case-sensitive:
50:text/x-c++src:*.C
50:text/x-c++src:*.C:cs
Old parsers will create an entry for "*.C:cs", which will probably never match 
any real file, so no big deal, while new parsers will take the second line as 
an indication that the *.C glob (parsed one line above) should be understood 
to be case sensitive.

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


More information about the xdg mailing list