lensfun 0.3.1.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 the same object is defined in multiple files, later definitions override earlier definitions, e.g. user can override system-wide definitions by placing appropriately 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 usually is /usr/share/lensfun/. However, this is configurable at compilation time, and for locally compiled lensfun, it is mostly /usr/local/share/lensfun/. A special directory is /var/lib/lensfun-updates: If it exists and contains a newer database, it is loaded instead of the main place. On Windows, this is something like C:\Documents and Settings\%User%\something but I'm not sure exactly :-).

“Newer database” means that the file timestamp.txt, which is amongst the XML files, contains a larger value. This value is the database timestamp in UNIX time.

After having read the global database, the user's home directory is searched. Usually, this is ~/.local/share/lensfun. The exact path can be found in the variable lfDatabase::HomeDataDir. The subdirectory updates/ may contain a user-specific DB update. This represents an alternative to /var/lib/lensfun-updates for which no root priviledges are needed.

So sum it up for Linux and other Unix-like platforms, the load order is:

1. the directory lensfun's database was installed into (usually /usr/share/{local/}lensfun), or /var/lib/lensfun-updates, or ~/.local/share/lensfun/updates, whatever is newest
2. ~/.local/share/lensfun

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.