桌面应用程序的配置存储

发布于 2024-09-14 07:11:33 字数 232 浏览 3 评论 0原文

选择其中之一有什么好处:

  • 用户主目录中的文件,例如
  • 使用用户的 gconf 数据库的

~/.myapp/config我已经知道了一些事情;将数据存储在用户的 gconf 数据库中会使用户将这些设置复制到另一个帐户或计算机上变得更加困难。另一方面,使用 gconf 是否真的会更容易,因为底层数据存储设施已经整理好,而无需编写自己的配置文件处理程序?

What are the benefits of choosing either:

  • a file in the user's home directory, e.g. ~/.myapp/config
  • using the user's gconf database

I already know a couple of things; storing data in the user's gconf database makes it a little harder for the user to copy those settings out and onto another account or computer. On the other hand, is it true that using gconf would be easier as the underlying data storage facilities are already sorted out, without you having to write your own configuration file handler?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江湖彼岸 2024-09-21 07:11:33

我会选择 GConf。

但是...

也许如果您担心用户将其设置复制到程序中或从程序中复制出来,您应该在程序中创建导入和导出设置功能?然后,用户可以将这些设置保存在 Ubuntu One 或 Dropbox 等云存储中,并使用您提供的实用程序将所需的设置简单地导入到 GConf 中,而不管机器是什么(即使他们更喜欢从 liveCD 运行)。无论哪种方式,都可以非常清楚地向用户指示存储设置的位置。许多(但不是全部)Ubuntu 用户习惯使用 rsync 或其他备份实用程序自行备份和恢复这些配置文件。

I'd go with GConf.

However...

Perhaps if you are worried about users copying their settings in and out of the program, you should create import and export settings functions into your program? A user could then potentially save those settings in cloud storage like Ubuntu One or Dropbox and simply import their desired settings into GConf using the utility that you provide, regardless of the machine (even if they prefer to run from liveCD). Either way, very clearly indicate to the user where the settings are being stored. Many (but not all) Ubuntu users are comfortable backing up and restoring those configuration files by themselves using rsync or another backup utility.

兔小萌 2024-09-21 07:11:33

与 GConf 一起去。它旨在存储程序的配置,这就是您应该使用它的用途。当你面前有一个完美的造轮设备时,为什么还要从头开始重新发明轮子呢?

Go with GConf. It was designed to store configuration for programs, and that is what you should use it for. Why should you re-invent the wheel from scratch when you have a perfectly good wheel making device in front of you?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文