On Wed, 2007-04-18 at 15:45 -0500, Les Mikesell wrote: > Gérard Milmeister wrote: > > >> Applications that simply go by the extension name are doing it wrong and > >> should be fixed. As it has already be pointed out there are better ways. > > Take an application such as nautilus. AFAIK, nautilus (or gnome-vfs, or > > whatever) used to look inside each file to determine what mime type it > > was, in order to display it alongside the name and attach an icon. This > > was very slow, since it had to open each file in a directory. Now it > > looks first at the extension, and if that does not determine the type, > > it looks inside it. Sometimes it guesses wrongly, and it makes you know > > about it when you try to open the file. > > Looking inside a file to determine a mime type is just another hack. The > > only correct way to do it is to attach meta-data to each file (using > > extended attributes, for example). However this would mean quite a > > radical change of how files are created, modified etc. > > There's also no reason to think that getting meta-data would be any > faster than getting data from the file - or that you would want a > filesystem designed with something other than getting the file data as a > higher priority. Meta-data (using extended file attributes) would be faster, since it wouldn't involve opening the file and trying to guess the file type from the file content. If you have selinux enabled, each file access involves accessing extended file attributes. -- Gérard Milmeister Langackerstrasse 49 CH-8057 Zürich