I have a program which creates certain save files during its use. Technically they are XML files, however I don't want to use the .xml extension as I will be modifying the shell so that my program opens when the files are double clicked in Explorer.

Is there any guidance on what file extensions I can effectively "invent"? I can't find any official guidelines anywhere.

I want to use .senx but I have no idea if this is safe to do so?

有帮助吗?

解决方案

There is no "official" registry of file extensions (although there probably should be).

An Internet search will reveal several different sites that contain unofficial listings of the file extensions in common use by various applications, but if you go by that, there are hardly any file extensions still available to choose from.

The important thing is to figure out which applications your target audience is likely to have installed, and then make sure that your custom file extension doesn't conflict with any of those. (If you must do so, you also must provide the user with an option to revert your file extension associations, and preferably make it a configurable option during installation.)

Remember that there's no reason you should have to limit yourself to three or even four character file extensions. You can use as many as you need, which exponentially increases the likelihood that your choice will be unique. For example, Visual Studio persists its environment settings in a .vssettings file; it's very unlikely any other application will conflict with that any time soon.

In fact, this is Microsoft's official advice:

Do Not Use Short File Name Extensions

Long file name extensions offer the following advantages:

  • The limited length of short extensions make them prone to extension collisions. An extension collision occurs when the same extension is used to classify multiple file types. Using long extensions significantly decreases the chances of a collision.

  • Short file names tend to be somewhat cryptic. Long extensions tend to be more meaningful because additional information can be embedded in the extension.

For more information, see file name extensions.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top