<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>lensfun: How database files are found and loaded</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); MathJax.Hub.Config({ messageStyle: "none" }); </script><script type="text/javascript" async="async" src="http://lensfun.sourceforge.net/mathjax/MathJax.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">lensfun  <span id="projectnumber">0.3.2.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div class="PageDoc"><div class="header"> <div class="headertitle"> <div class="title">How database files are found and loaded </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><p>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.</p> <p>A typical application will initialize the lens database by calling the method <a class="el" href="structlfDatabase.html#ac688c19eb77c64aa6f2be002f8e31e72" title="Find and load the lens database.">lfDatabase::Load()</a> with no parameters. This method searches for all available XML files and loads them, ignoring files with errors.</p> <p>The main place where Lensfun looks for database files usually is <b>/usr/share/lensfun/version_<em>x</em></b>, where <em>x</em> is the database format version (<a class="el" href="db_versions.html">Database format versions</a>). However, this is configurable at compilation time, and for locally compiled Lensfun, it is mostly <b>/usr/local/share/lensfun/version_<em>x</em></b>. A special directory is <b>/var/lib/lensfun-updates/version_<em>x</em></b>: If it exists and contains a newer database, it is loaded instead of the main place. On Windows, this is something like <b>C:\Documents and Settings\%User%\something\version_<em>x</em></b> but I'm not sure exactly :-).</p> <p>“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.</p> <p>After having read the global database, the user's home directory is searched. Usually, this is <b>~/.local/share/lensfun</b>. The exact path can be found in the variable <a class="el" href="structlfDatabase.html#a447ef93e9d8d443b0f42d0ed7b837184" title="Home lens database directory (something like "~/.local/share/lensfun")">lfDatabase::HomeDataDir</a>. The subdirectory <b>updates/version_<em>x</em></b> may contain a user-specific DB update. This represents an alternative to /var/lib/lensfun-updates/version_<em>x</em> for which no root priviledges are needed.</p> <p><b>~/.local/share/lensfun/version_<em>x</em></b> is also scanned with higher priority than the one without the version_<em>x</em>, so that the user can set entries specific for a database version. This is useful only if you need to maintain two or more different Lensfun versions on your system.</p> <p>So sum it up for Linux and other Unix-like platforms, the load order is: </p><ol> <li> the directory Lensfun's database was installed into (usually /usr/share/{local/}lensfun/version_<em>x</em>), <em>or</em> /var/lib/lensfun-updates/version_<em>x</em>, <em>or</em> ~/.local/share/lensfun/updates/version_<em>x</em>, whatever is newest </li> <li> ~/.local/share/lensfun </li> <li> ~/.local/share/lensfun/version_<em>x</em> </li> </ol> <p>Another way to load database file is to load them one by one. For this you call <a class="el" href="structlfDatabase.html#a6e052ffddd1e8d927ff53a2769fa59c0" title="Load just a specific XML file.">lfDatabase::Load(const char *)</a> for every XML file that must be loaded. </p> </div></div><!-- PageDoc --> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Oct 3 2019 15:07:50 for lensfun by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.15 </small></address> </body> </html>