Mikkel L. Ellertson wrote:
browsers, at least when the correct content type is sent. We have file viewers and A/V players that use mime-type to decide how to handle a file send to them. Why not file manages that do the same? Now, there are a couple of problems here - there are some file types where there isn't a "magic number" to determine the mime-type. How do you tell the difference between a C source file, a header file, and a plain text file? So you might have to use extensions there. (If you want to open all three in the same editor, then it isn't a problem...)
You can determine that it's text. The best way to do it is to store the mime-type in the filesystem. Other approaches have to try looking at the extensions and parsing. For example with Ogg it's fairly easy to come up with a magic number to identify an Ogg stream, but you need to do more work to identify its contents. -- imalone