lensfun 0.2.8.0

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

How database files are found and loaded

In a typical application, all XML files are loaded automatically at startup.

If same object is defined in multiple files, later definitions override earlier definitions, e.g. user can override system-wide definitions by placing appropiately formatted XML files in its home directory.

A typical application will initialize the lens database by calling the method lfDatabase::Load() with no parameters. This method searches for all available XML files and loads them, ignoring files with errors.

The main place where lensfun looks for database files are the directories returned by the gtk function g_get_system_data_dirs(). This is (usually) the /usr/share/lensfun/ subdirectory (the part after /usr/share/ is configurable at library compilation time) and also the /usr/local/share/lensfun/ directory for system-local files. On Windows this is something like "C:\Documents and Settings\%User%\something" but I'm not sure exactly :-).

After that the user's home directory is searched too, as returned by g_get_user_data_dir() with "lensfun" appended as well. On my system this is /home/user/.local/share/lensfun. The exact path to the user-specific directory can be found in the variable lfDatabase::HomeDataDir.

Another way to load database file is to load them one by one. For this you call lfDatabase::Load(const char *) for every XML file that must be loaded.