Re: gmc associations



sml13@cornell.edu writes:

> http://www.berlin-consortium.org/datatype.html
> 
> Has anyone considered using this library for determining MIME types 
> and/or desktop icons?  I think the UNIX file command is, like, really 
> cool; it would be great if we had some smart (fast too, of course :-) way 
> to determine file types regardless of those meaningless file extensions.

Well, how can you do that (and keep it fast)?

  a) make assumptions based upon the filename - 1 I/O per directory.
     Very fast.  Good for FTP/HTTP filesystems.

  b) open up the file and read it's data and then make assumptions
     based upon magic numbers and so forth (ie "file" or LibDataType).
     usually only 1 I/O per file, so not as fast as a).  Usually fast
     enough for local and LAN filesystems.

  c) Keep data associated with each file containing the type of data
     of the file (c.f. Macintosh).  This is out of scope of GNOME and
     IMHO really stupid :) Still usually at least another I/O per
     file.  Possibility of bung file types in this resource fork.
     Again, stupid.

  d) Assume a), open the file and check for file type suggested by a)
     first, otherwise use b).  1 I/O per file.

Or

  e) Use technique a) or d), based upon user preferences.  You might
     specify a) for HTTP and FTP filesystems, but d) for local and NFS
     filesystems.  NFS to server "turtle" use a).  If method d) takes
     longer than 10 seconds, give up and fall back to a).

-- 
Sam Vilain, sam@whoever.com         work: sam.vilain@unisys.com
http://www.hydro.gen.nz                home: sam@hydro.gen.nz



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