跨平台配置、选项、设置、首选项、默认值
我对人们关于如何最好地在跨平台应用程序中存储首选项和默认设置的看法感兴趣。
我主要在 *nix 和 Windows 上使用 Node.js 和 Perl,但我也对更大的前景感兴趣。
在 *nix 世界中,“点文件”(和目录)非常常见,系统范围或应用程序默认设置通常驻留在一个路径中,而用户特定的设置则驻留在主目录中。此类文件和目录以点“.”开头。并默认从目录列表中隐藏。
Windows 具有注册表,其中还包含默认值和每用户覆盖的路径。
某些跨平台应用程序以自己的方式执行此操作,Firefox 使用 JavaScript 首选项文件。
跨平台应用程序是否应该跨平台使用同一个系统,或者说 *nix 上的点文件和 Windows 上的注册表?您最喜欢的编程语言是否有用于以标准方式访问它们的库或模块?是否有新兴的最佳实践,或者每个人都推出自己的最佳实践?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
那么存储在DB中呢?它对集群友好,并且对我们来说效果很好。在我的上一份工作中,我们曾经将它们存储在目录服务器中。
Java 以 Preferences API。
我不是 .Net 用户,但我认为他们有用户配置文件。
Python具体讨论: What's theficial way of storageing settings python 程序?
Ruby on Rails:Rails:存储用户的最佳实践设置?
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?
我找到了
docs.python.org/lib/module-ConfigParser.html 和
wxpython.org/docs/api/wx.ConfigBase-class.html
I found
docs.python.org/lib/module-ConfigParser.html and
wxpython.org/docs/api/wx.ConfigBase-class.html