Re: Suggestion for file type detection approach



On Sat, 2004-01-03 at 00:57, Yves Dionne wrote:
> On Thu, 2003-12-25 at 20:47, Fabio Gomes wrote:
> > Em Qui, 2003-12-25 �21:58, Adam Williams escreveu:
> > 
> > > Why not support recording the mime-type of a file as meta-data (EA) on
> > > filesystems that support it (every one of them at this point?).  It
> > > would take awhile to be adopted by most/all GNOME apps but seems (IMHO)
> > > to clearly be the right way to do it.   If GNOME VFS supported it then
> > > it seems it would be easy to implement for alot of applications.
> > > 
> > 
> > I agree with you, but while we must provide a quick solution, EA (and
> > the attributes themselves) must be standardized cross-unix and
> > cross-desktop. This will take some time to mature, since the mechanisms
> > for sending files through the Internet (between computers, in general)
> > must mature to support EA. I never used Apple operating systems, but it
> > looks like they have such a mechanism. Nothing that a tar with EA
> > support could not do. 
> > 
> > GNOME must provide room today to support state-of-the-art technologies
> > in the future, but must at the same time provide solutions to today's
> > users using today's technologies.
> > 
> > > File extenstions are just DUMB and EASILY broken.  Sniffing is expensive
> > > and unreliable.
> > 
> > Indeed, but it's all we have for now. Now = 2.6.
> 
> I thought this could be fun, so hacked gnome-vfs to save the mime type
> on a EA named "mime_type".

I think this is a great idea - in particular it gives users something
they can adjust if the sniffing gets it wrong.

If EAs aren't available, perhaps such "sniff overrides" could be stored
using the Nautilus metadata system?  Though that would make things even
slower.

> 
> When trying to find the mime type for the file, gnome-vfs will first
> check if this EA exists. If so, use that for the mime type. If not,
> determine the mime type as usual and save it.
> 
> It works only for local files. If you don't have permission to change
> the file, the EA will not be saved. And you need a file system which
> support EA, of course. I tested it with ext3. Might work with others
> too.
> 
> This is a hack, just an exercise to see if it could be beneficial. I did
> this just for fun. I did not try to follow coding standards, I have no
> intention of maintaining this patch. Although I might try to hack
> nautilus to allow changing the mime type (as recorded in the EA).
> 
> The following patch is against gnome-vfs-2.4.1 as found in Fedora. I
> attach also a modified SPEC file, just in case someone wants to build
> it.




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