Re: RFP: shared filetype autodetection library



On Wed, Apr 10, 2002 at 10:09:53AM -0400, Dom Lachowicz wrote:
> 
> What I'd like to see is a mechanism that, when passed one or more of:
> 
> * A file (how we choose to represent this is up in the air and not wholly 
> important- FILE*, byte buffer, GnomeVFSHandle, other)
> * A portion of a file's contents (initial 2k or 4k or something similar)
> * A
> file's extension
> 
> We get back some magic data, ideally a mime-type and possibly other 
> extended information.

Sounds good, having this in a distinct library would be solve
something that has irritated me in Gnumeric.  We currently keep the
identification function with the i/o routines.  So we end up loading
all the plugins when faced with a file that does not have a known
extension.

Several things to consider.
1) There is definitely code in gnome-vfs for this
2) Can we use the code in linux or bsd file ?
3) Mime type is not sufficient, we need to identify version in some
   cases.
4) Suffix matching is a useful but dangerous optimization.  People
   have been known to accidentally save a file in 1 format with
   another extension by accident.
 
I suspect the nautilus folk will have some useful input also.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]