Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location to put user configuration files in windows

I'm writing a python library that has a per-user configuration file that can be edited by the user of the library. The library also generates logging files. On *nix, the standard seems to be to dump them in $HOME/.library_name.

However, I am not sure what to do with Windows users. I've used windows for years before switching to Linux and it seems that applications tended to either A) rely on GUI configuration (which I'd rather not develop) or B) dump configuration data in the registry (which is annoying to develop and not portable with the *nix config files)

I currently am dumping the files into the $HOME/.library_name on windows as well, but this feels very unnatural on Windows.
I've considered placing it into %APPDATA%, where application data tends to live, but this has its own problems though. My biggest concern is that lay users might not even know where that directory is (unlike %HOME/~), and user-editable configuration files don't seem to go here normally.

What is the standard location for per-user editable config files on windows?

like image 922
UsAaR33 Avatar asked Feb 11 '10 10:02

UsAaR33


2 Answers

The python appdirs package does a nice job of finding the standard place for application data on various platforms. E.g. for Windows it uses the English XP location:

C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName>

and on Linux it follows the XDG standard:

 ~/.config/<appname>
like image 194
nealmcb Avatar answered Oct 11 '22 15:10

nealmcb


%APPDATA% is the right place for these (probably in a subdirectory for your library). Unfortunately a fair number of *nix apps ported to Windows don't respect that and I end up with .gem, .ssh, .VirtualBox, etc., folders cluttering up my home directory and not hidden by default as on *nix.

You can make it easy even for users that don't know much about the layout of the Windows directory structure by having a menu item (or similar) that opens the configuration file in an editor for them.

If possible, do provide a GUI front-end to the file, though, even if it's quite a simple one. Windows users will expect a Tools | Options menu item that brings up a dialog box allowing them to set options and will be non-plussed by not having one.

like image 22
T.J. Crowder Avatar answered Oct 11 '22 16:10

T.J. Crowder