in reply to Cross-platform open document

Windows cheats: it links the file-extension (everything after the last dot in the file name) to a program that is supposed to be able to do something with this "type" of file.

Have you ever tried to add .xls to an HTML-file and then double-click on it? (go ahead try it -- I will wait) Funny, isn't? It proves that the knowledge how to open a file is not only in the registry but also in the programs themselves, hence there is no single place to collate this information.

The well-known notepad.exe program knows how to open (for a very limited definition of "open") almost every type of file, but it can only do something useful with text-type files.

Some files can be more reliably recognized from their headers: our #!/usr/bin/perl springs to mind, or the magic bytes in some files.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James