Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
main.c File Reference

Rebuild the lens-correction database from this machine's lensfun installation. More...

#include "common/file_location.h"
#include "common/paths.h"
#include "whereami.h"
#include "lensserious_import.h"
#include <glib.h>
#include <glib/gstdio.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "osx/osx.h"
#include "win/main_wrapper.h"
+ Include dependency graph for ansel-lens-db-update/main.c:

Go to the source code of this file.

Functions

static void usage (const char *progname)
 
int main (int argc, char *argv[])
 

Detailed Description

Rebuild the lens-correction database from this machine's lensfun installation.

Ansel ships a lenses.db built at package time from upstream's published calibrations. That is the right default and it is all most people ever need. What it cannot contain is a profile that did not exist when the package was built: a calibration upstream published since, or – the case this tool exists for – one the user measured themselves and wrote into ~/.local/share/lensfun.

Those profiles are only ever present at RUNTIME, on the machine that has them. A build runner has none, so no amount of care at package time can pick them up. Hence a separate command, run by the person who has the profiles.

It deliberately makes no attempt to be clever about aggregation. lensfun already defines where profiles live and which wins when two disagree – the system database, the system updates directory, the user's updates directory, and the user's own hand-written profiles, with the last always overriding – and ls_import_run(..., NULL) calls lensfun's own lf_db_load() to apply exactly those rules. Re-deriving them here would be an approximation of a moving target.

Nor does it fetch anything. Downloading upstream's newest calibrations is what lensfun's own lensfun-update-data is for, and it writes them into one of the directories above. Run that first if that is what you want; this converts whatever lensfun can currently see.

Note
Close Ansel first. The result is written to a temporary and renamed into place, so a running Ansel can never read a half-written file – but each of its threads holds its database handle open for the life of the process, so it would go on using the old one until restarted. Nothing breaks; the update simply would not appear.

Definition in file ansel-lens-db-update/main.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
Todo:
: test if file with replaced ext exists
Todo:
: add a callback to set the bpp without going through the config
Todo:
: have a parameter in command line to get the export presets

Definition at line 105 of file ansel-lens-db-update/main.c.

References dt_loc_configdir(), dt_loc_datadir(), dt_loc_init_datadir(), dt_loc_init_user_config_dir(), dt_osx_prepare_environment(), DT_PATH_MAX, k, and usage().

◆ usage()

static void usage ( const char *  progname)
static

Definition at line 75 of file ansel-lens-db-update/main.c.

Referenced by main().