News for hackers. Stuff that matters.
Re:Add .txt As the Extension of Your Readme file by drcube on Tuesday April 30, 2013 @03:16PM (#5634292)
Besides being a joke based off a classic Dilbert cartoon, Windows really is broken, at least in this one specific area.

File extensions should only be used by people. The OS should have other ways of knowing the file type. And ".txt" is redundant. The default assumption should be "text" and only other file types should require extensions. IMHO.

Re:Add .txt As the Extension of Your Readme file by shocks on Tuesday April 30, 2013 @03:23PM (#5634346)
Notice that I never disagreed with anyone on this. I also think that file extensions are broken. My issue is that you (and a few others) lay the blame solely on Redmond. The issue of file extensions goes far beyond Windows. Every operating system is subject to them.
Re:Add .txt As the Extension of Your Readme file by drivebyacct2 on Friday May 03, 2013 @04:46PM (#5652560)
No actually, not really.
Re:Add .txt As the Extension of Your Readme file by mrbrowning on Tuesday April 30, 2013 @03:35PM (#5634411)
Out curiosity, what sort of mechanism do you think is best for the OS to figure out the file type? Metadata can be opaque and leads to applications being rigid about what type of input they'll accept, and sniffing magic bytes can't possibly be sufficiently reliable. Relying on extensions is suboptimal in terms of polluting what should be a logically independent attribute of a file, the name, with information about its type, but practically it seems like a serviceable and flexible solution.
Re:Add .txt As the Extension of Your Readme file by yew on Tuesday April 30, 2013 @03:47PM (#5634468)
The 'correct' way to determine the type of a file is indeed to look at metadata. This includes things like magic numbers and extensions, but shouldn't be limited to those things.

Just looking at extensions can be misleading because not all files have extensions and some extensions correspond to multiple types of files. In general, no method will be perfect because no modern OS provides dedicated file typing (some older operating systems stored the file type as metadata, although even that breaks down at the boundary between your computer and the rest of the world). The imperfection is usually manageable, depending on the type of file (which is the real answer to your question - it depends on why you want to know).

Applications that won't open what I tell them to because they disagree about the file type are just broken. (Having to rename files whenever I want to open them is annoying. Having to replace a good piece of software because it refuses to follow instructions is even more annoying.)