Shared-mime checking order
dfaure at trolltech.com
Wed Sep 19 13:15:00 PDT 2007
On Tuesday 18 September 2007, Daniel Leidert wrote:
> But I would like to raise a different issue: Let's take the above
> example and let's say, that I define a very specific MIME type
> <mime-type type="text/x-mytest-one">
> <comment>My test case one</comment>
> <glob pattern="README.txt"/>
> <sub-class-of type="text/plain"/>
> <magic priority="100">
> <match value="mystring" type="string" offset="0"/>
> which MUST have the string "mystring" at offset 0.
"MUST" is wrong. magic is about having "hints" about what the file might be,
there is never a strong rule that the file MUST have this magic.
> Now I create a
> README.txt file with the content "blah" - definitely not of type
> text/x-mytest-one then. But gnomefs-info reports in both modes, that the
> file is of type text/x-mytest-one (because I don't have a KDE4
> installed, I cannot test your solution David). So: Is it possible to
> assign an extra mode, if the priority is 100 or very high, so only if
> the magic pattern matches (too), the MIME type can be of this type -
> maybe only do this in slow mode - or change the checking order in slow
> mode to follow the spec, which IMHO would fix this problem too.
It sounds like you're asking again for the "high priority sniffing" which we
just decided against for performance reasons. We don't want to open up
all the files when the glob gives us enough information anyway.
OK in your case only README.txt files would be opened, but as soon as
there is such a mechanism people will obviously abuse it, so we better
make sure there is really a need for it first.
Is there a real world use case for this? README.txt and "mystring" is hardly one :-)
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the xdg