Cross-platform configuration, options, settings, preferences, defaults

一世执手 提交于 2019-12-07 03:14:55

问题


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 path 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?


回答1:


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?




回答2:


I found

docs.python.org/lib/module-ConfigParser.html and

wxpython.org/docs/api/wx.ConfigBase-class.html



来源:https://stackoverflow.com/questions/4488320/cross-platform-configuration-options-settings-preferences-defaults

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!