Cross-platform configuration, options, settings, preferences, defaults
I'm interested in peoples' views on how best to store preferences and default settings in cross-platform applications.
I primarily work in node.js and Perl on *nix and Windows but I'm also interested in the bigger picture.
In the *nix world "dotfiles" (and directories) are very common with system-wide or application default settings generally residing in one pa开发者_Python百科th and user-specific settings in the home directory. Such files and dirs begin with a dot "." and are hidden by default from directory listings.
Windows has the registry which also has paths for defaults and per-user overrides.
Certain cross-platform apps do it their own way, Firefox uses JavaScript preference files.
Should a cross-platform app use one system across platforms or say dotfiles on *nix and registry on Windows? Does your favourite programming language have a library or module for accessing them in a standard way? Is there an emerging best practice or does everybody roll their own?
What about storing in DB? It is cluster-friendly and has been working great for us. In my last job we used to store them in a directory server.
Java has support in the form of Preferences API.
I am not a .Net guy but I think they have User Profiles.
Python specific discussion: What's the official way of storing settings for python programs?
Ruby on Rails: Rails: Best practice to store user settings?
I found
docs.python.org/lib/module-ConfigParser.html and
wxpython.org/docs/api/wx.ConfigBase-class.html
精彩评论