On Mon, 15 Mar 2010 14:17:19 -0500, Programmer In Training <[email protected]> wrote: > On 03/15/10 14:05, Richard Travers wrote: >> In article <[email protected]>, >> jonathon <[email protected]> wrote: > <snip> >>> This is used for: >>> * TeX/BibTex files; >>> * e-Sword Bible resources; >>> * Pocket e-Sword Bible resources; >>> * At least five other mutually incompatible programs; >> >>> Take the extension ".wks". >>> This is used by: >>> * MSWorks; >>> * XLisp WorkSpace; >>> * Tandy Deskmate; >>> * Lotus 123; >> >>> Or maybe you prefer to explain how to differentiate between the ten >>> (or more) mutually incompatible file formats that use ".doc" as the >>> file extension. >> >> But there has to b e a system - whether it is a code incorporated in the >> file name, or a code incorporated in the file (there has to be some code >> or >> pattern or there is NO way of identifying the file). > > Really there is no good way to automate file-type detection when so many > files share the same extension. The best way is to encourage best > practices for end users (such as saving documents in folders > specifically for those applications). Software cannot (and probably > shouldn't try to) take at least this burden off the end user. It gets > difficult when you start sharing files amongst a growing group of users, > but it's a good beginning at the very least. > >> Your above examples say nothing about the method used to identify the >> file, >> only about the way it has been implemented. > > At least under Windows, the method is a registry entry tying the > extension to the last application to register that as one of it's > extensions (I imagine KDE does something similar, I never dug too deep > into KDE to find out for myself though). Under the various *Nix's I do > not believe there is an OS level method of automatic file type detection > (for example, vim will warn you that you're trying to open a binary and > then open it anyway, along with just about any other file you toss at > it, I've even "opened" archived files and viewed their contents with > some degree of success).
In actuality the first couple of lines of a file often identify the source program when you look at them with a hex editor. This should be common practice but is not as common as I would like it. In this way one would have two ways to identify a program to open the file, the header and the extension. I know that I will have a program say that the file is not a supported format when it can't open it. If I look at the header I can often see why. Best, Allen --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
