gtorrent/gtorrent-core — pull request #78 by fuyukaidesu (2014-08-02 22:43:53+00:00)
Title: Implement settings.

The settings currently implemented aren't all there is to libtorrent, but probably some major settings.
Fixes some bugs, too, and rename >>>offensive variables.

To use, #include "Settings.h", and gt::Settings::settings[key], where key is a string, and the value returned by the expression is a string.
If the key doesn't exist, it'll return an empty string.
The configuration file is completely rewritten when saving, trashing any comments, keys that were missing in the file will be saved too.

Regarding this behavior, you may notice that most utilities that relies on a config file written by the user doesn't not modify it, ever, while the programs that do not ask the user to manually configure it completely rewrite their configs, and may even encode it in a format that can't be easily modified.

If we don't touch the config except for reading, then we won't be able to edit the config later with changes made at runtime, except of course implementing a parser ourselves or adding another library.

We should leave the capacity to the user of modifying the configuration himself, but without guaranteeing him he'll keep any comment or unneeded things in the config. This will enable the user to customize the configuration file while keeping the ability to make changes at runtime.