[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: mimetype determination (Re: KFile plugins)
From:       Luciano Montanaro <mikelima () cirulla ! net>
Date:       2005-10-17 10:38:10
Message-ID: 200510171238.10845.mikelima () cirulla ! net
[Download RAW message or body]

El Lunes, 17 de Octubre de 2005 10:49, David Faure escribió:

> > I agree. Guessing the file type from content won't be a problem
>
> I don't agree, and it would be a problem. Why? Because it's not 100%
> reliable. You can't reliably detect the mimetype of files from their
> content; been there, done that. E.g. a file with "class, final, static"
> in it could either be C++ or Java or just some english text which happens
> to use those words.

David, thank you a lot for the clarification. I won't argue whith you on 
this matter - in the end this is a matter of policy and pragmatism, and 
using file extensions is faster for sure than scanning the file. 

However, I'm happy to know there will be a more flexible way of determining 
the mime type of a file in the future.

I suppose there would be less confusion if the documentation for the KDE 
mimetype subsystem were better or easier to find. Hopefully, this thread 
may be useful to improve this too.

Ciao,
Luciano
 
> When an extension is specified in the mimetype definition, it *has*
> priority. For mimetypes where the extension is ambiguous, then OK, just
> remove the mimetype definition and add magic snippets.
>
> To answer the other (mostly wrong) things said in this thread:
>
> * yes the mime-magic mechanism is used in KDE already, for files without
> extension or files with an "unknown" extension (i.e. one not listed in
> Patterns=)
>
> * yes the mime-magic mechanism is extensible, just drop a .magic file
> in share/config/magic/.  However this has its limits, it can't be a
> specialization of a pattern that is listed in the main magic file (so
> e.g. it wouldn't work for koffice files, since they are ZIP files; order
> matters, so the zip magic is found first).
>
> * for KDE4 the plan is to switch to freedesktop.org mimetype standard,
> which includes a way to define "magic" sniffing from within the mimetype
> definition itself; and a way to define priority between extension and
> magic for a given mimetype.

-- 
Luciano Montanaro //
              \\ //
               \x/ www.cirulla.net
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic