CAPS Universe documentation  1.0.4
All you need to know to be successful
1003 Ensure read order for INI files

1003 Ensure read order for INI files

Some directories contain more than one INI file. In some directories the read order isn't important, but in some other it is. In the CAPS Printer Device Parameter Directory for example the read order is important, since their content can overwrite each other. Thus, some kind of predictable read order is required.

Solution

Switch to the scandir() API in libcapsinif. This API supports a version order where file names with numbers in it will be sorted according to these numbers. This includes file names like 1-name.ini, 1-name.ini and 10-name.ini, where the 10-name.ini will be the last one in the list.

Impact

Users of libcapsinif should not be aware of this change, since there are no changes in the lib's API. Making use of this new feature is up to the user and the selected INI file names.
caps_inif_dir_read() and caps_inif_dir_merge() both makes use of this new internal feature. But in order to overwrite the same key, caps_inif_dir_merge() must be used. The caps_inif_dir_read() still reports an error if the same key from the same section from the same directory should be overwritten.

State

Described behaviour available with libcapsinif-1.1.0