Re: [AD] possible bug in override_config_file |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Eric Botcazou: >> If I use set_config_file(/path/to/var/allegro.cfg) midi is not >> initialised, as expected, but it is initialised if I instead use >> override_config_file(). Correction: by not initialised, I meant set to MIDI_NONE. > Could you post the sketch of your initialization code? Of course, but when I tried to duplicate the problem in a simple recipe, it turned out to be my code at fault. The problem was caused by me using both override_config_file() and, later on, override_config_data(), as follows: allegro_init(); override_config_file("/path/to/overrides.cfg"); std::string setting("[sound] \n flip_pan = 0"); override_config_data(setting.c_str(), setting.length()); After the call to override_config_data() the program "forgets" the values in overrides.cfg. I guess this is intended behaviour. Maybe it wouldn't hurt to spell this out in clear text in the docs, or maybe I just need a new brain. :) The following code achieves what I wanted: allegro_init(); push_config_state(); set_config_file("/path/to/overrides.cfg"); set_config_int("sound", "flip_pan", 0); pop_config_state(); override_config_file("/path/to/overrides.cfg"); A bit ugly, but I can live with it. BTW, I noticed that the code example in override_config_data() doc uses multiline string. AFAIK, that feature is deprecated, and if I'm wrong, it's still easy to miss the fact that it's a multiline string, and therefore not think you need to separate category and variable names using newlines. The attached patch (against 4.1.14) removes possible confusion. Kind regards, Daniel Schlyder -- http://bitblaze.com/
Attachment:
override_config_data_doc.diff
Description: Binary data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |