views:

56

answers:

4

I'm working on a little game and figured I'd pack images and other resources into my own files to keep the directories neat. Then I thought, is there any convention to what I should call my file, or can I simply call it what ever without anyone ever caring? There's probably not a lot of strong opinions about this rather innocent subject, but I thought I'd better have some kind of response on it.

The most obvious would be to not use reserved characters.

< > : " / \ | ? *

Those are the ones for windows. Anyone care to add what characters are reserved on other systems?

There's some standard suffixes that I'm guessing shouldn't be used, unless the file actually apply to the suffix's standard.

.bat .exe .dll .lib .cmd

And then there's all the image file types and what not, but those are about as obvious. What more?

What is your opinion? Should I name my suffix as uniquely as possible, say .maf (My Awesome File) or what ever... or should I be more informative and stick to a known suffix that might reveal what my file is actually doing there? Or perhaps a bland old .dat or .bin?

+2  A: 

Unix platforms don't have filename restrictions (other than NULL and forward slash), so don't worry about any characters other than what Windows doesn't like.

You can worry about using an extension that hasn't been used before, but unless you want to use a really long one, I'd say don't bother, you can always go with something generic like .dat or .bin. You don't actually need to even use an extension, which (imo) is just as good, unless you will be distributing some of these files other than with the program (for example, user made maps, you will want to have an extension since users will be distributing the files).

Another minor point you might want to consider is that MS DOS extensions need to be exactly three characters after the dot. Being DOS compatible isn't a huge issue (not an issue at all really), but that's why you'll see a lot of extensions are three characters.

Jeffrey Aylesworth
+1  A: 

Use what makes sense to you - I would avoid well known extensions, as you have proposed to avoid them being accidentaly opened by another application.

Most applications/games will give an extension that is related to the application name or use (.doc, .psd etc...).

Oded
+3  A: 

If you want to create something that you want to associate with your program, you do, of course, want it to be as unique as possible. When you come up with an extension, check with FILExt to see if it's conflicting with anything major.

If you just want to convey "this is a binary file, don't try to open it in notepad or tamper with it", i'd go with something like .bin, yes.

David Hedlund
A: 

Unless users are going to double-click on the files from explorer, having a nice informative, unique extension is not important, so you might want to go with .bin or .dat. However there exist good mechanisms for packing files together (.zip or .7z) so you might want to go for a standard packer, with a standard extension.

Douglas Leeder