04-21-2012, 02:30 AM
I'd like to propose a change to the way cIniFile handles its SetValue() calls.
Currently, if any of the SetValue() family of functions is called, the value is searched for and if it exists, a *new* value is added (resulting in duplicate value being stored in the file). This can be fixed by setting the "create" parameter to false, but then the value is not created if it doesn't exist at all.
I'd say the semantics that is the most useful is "set if it exists, create if it doesn't", which are not available in the current code. I can't really see any use for duplicate values in the file, since the code is unable to load them back later (only the first match is always reported).
I'm therefore proposing to change the SetValue() method to ignore the "create" parameter if the value already exists, and always overwrite the value.
Are there any objections?
Note that this function is available at plugin-interface level, too, so plugins will be affected as well.
Currently, if any of the SetValue() family of functions is called, the value is searched for and if it exists, a *new* value is added (resulting in duplicate value being stored in the file). This can be fixed by setting the "create" parameter to false, but then the value is not created if it doesn't exist at all.
I'd say the semantics that is the most useful is "set if it exists, create if it doesn't", which are not available in the current code. I can't really see any use for duplicate values in the file, since the code is unable to load them back later (only the first match is always reported).
I'm therefore proposing to change the SetValue() method to ignore the "create" parameter if the value already exists, and always overwrite the value.
Are there any objections?
Note that this function is available at plugin-interface level, too, so plugins will be affected as well.