Case insensitive mimetype matching edge case
David Faure
faure at kde.org
Tue Aug 18 10:42:57 PDT 2009
On Tuesday 18 August 2009, Bastien Nocera wrote:
> On Tue, 2009-08-18 at 15:25 +0200, David Faure wrote:
> > On Wednesday 05 August 2009, David Faure wrote:
> > > Seems to me that we should instead introduce an attribute for
> > > case-sensitivity: <glob pattern="*.C" case-sensitive="true"/>
> > > and do everything else case-insensitively.
> >
> > This would also fix bug
> > https://bugs.freedesktop.org/show_bug.cgi?id=22634 because we could say
> > that
> > <glob pattern="core"/>
> > should be case-sensitive="true" as well, so that it doesn't match files
> > named "Core", which are definitely no core dumps.
> >
> > Any reason against case-sensitive="true"?
>
> Probably not, except status quo. Feel free to fix.
OK, I'm starting to work on this.
One problem is again the generated globs2 file. It has to contain this
attribute too, in some form, but any change in the format of this file breaks
existing parsers.
So either we need a globs3 file (*), or we need a hack like using comments:
# case-sensitive=true
50:text/x-c++src:*.C
(*) if we go for a globs3 file instead, adding another 26K of bloat even on
small devices :-), I suggest we make this more extensible for future changes
so that we don't need a globs4... We could specify that parsers should ignore
everything after the last ":" they know about. That is, they should be ready
for
50:text/x-c++src:*.C:[anything here]
where they expect
50:text/x-c++src:*.C
I guess for now the globs3 format would be
50:text/x-c++src:*.C:cs
(cs == case sensitive) and
50:text/x-csrc:*.c
but which could later be extended to
50:text/x-c++src:*.C:cs:[future extension]
50:text/x-csrc:*.c::[future extension]
(note the empty "cs" field)
What do you think? Extensible format in globs3, comment-based hack
(probably a bit ugly to implement), or do you have another idea?
--
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