Re: GLib file magics



Tim Janik <timj@gtk.org> writes:

> On 27 Jul 2000, Maciej Stachowiak wrote:
> 
> 
> the result is a user supplied gpointer data; if you care to look at the API ;)
> besides, the magic matching code is required by BSE (depends on glib only),
> gimp (doesn't depend on gnome-vfs (yet)) and gdk-pixbuf (doesn't have
> gnome-vfs around either).

I am tempted to go into a Miguel-style flame now about foolish fear of
dependencies being the enemy of sane code reuse, but that wasn't
really my point.

> but it's pretty orthogonal to that anyways, you could even use it to
> 1) validate your mime type lookups from pure file extensions
> 2) figure mime matches for files where extension matches failed.

The gnome-vfs (formerly gnome-libs) system matches based on both magic
and file extension (and also possibly file regexp pattern). Soon it
will also support algorithmic detection of ascii text and mp3 files,
since neither of these formats can be detected by magic number alone.

As I said, you should look at the existing code and see if you can
either copy it into glib, or at least provide the same feature set so
we can eliminate the duplication later. The current code does assume a
central list of magic info and filename/extension patterns, and always
returns a mime type rather than user-defined data, but I see no
particular reason to allow either the match set or the return value to
be user-supplied.

 - Maciej





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