May 30, 2005 at 5:53PM An Appeal to Windows Programmers
Please, do not store stuff, especially if it’s user-specific, in the Registry unless you really need to. There’s an environment variable called APPDATA that gives the path to a directory in the user’s home directory where you can store your settings. Use this.
Also, don’t use the USERPROFILE variable to figure out where to put your settings--I’m looking at you, GSView, GVim, PuTTY and Delphi--using APPDATA is much cleaner.
Thank you.
P.S. If you’re wondering why I’m saying this, it’s because I ought to be able to make a copy of the “Application Data” folder to back up my personal settings in one go.
P.P.S. Store your settings such that if you store your settings under “Application Data” as you should, you should have some way of indicating that a path is relative to the “Application Data” directory or your own one beneath it. Firefox and Thunderbird are offenders on this count.
P.P.P.S. Use text files. Something like INI files or Java-style property files are best in most cases. If your application has a built-in scripting language, using that’s a good idea. Use XML if you really have to. But please don’t use binary data unless you can’t avoid it.
1 On May 31, 2005 at 9:36, Revence 27 wrote:
But the MSDN library (starting with the ‘98 one) was all out against using INI files. The argument was that the registry in Win32 had been expanded from the measly 64kB that had been a silent deterent. But you got a point. Visual Basic devs find it easier using the intrinsic Registry support than fidgeting with INIs. Your own silent protest, right?
2 On June 13, 2005 at 17:14, Keith wrote:
The real problem with the registry is that it stores all its data in one big opaque binary file.
But my real point here is that the registry should be used sparingly, and that the file structure that’s already there should be used properly and in such a way that it ought to be trivial to do a backup of your settings.