开发者

Configuration storage for a desktop application

开发者 https://www.devze.com 2023-01-11 16:40 出处:网络
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

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 usin开发者_如何学编程g gconf would be easier as the underlying data storage facilities are already sorted out, without you having to write your own configuration file handler?


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消