Add Lensfun DB lookup fallback directory

Load from the bundled database directory if loading from the configured
location fails.
This commit is contained in:
Lawrence Lee 2022-11-24 13:09:30 -08:00
parent 331b3af0e4
commit 255dc13843
No known key found for this signature in database
GPG Key ID: 048FF2B76A63895F
4 changed files with 17 additions and 2 deletions

View File

@ -58,10 +58,20 @@ int init (const Settings* s, const Glib::ustring& baseDir, const Glib::ustring&
#pragma omp section
#endif
{
bool ok;
if (s->lensfunDbDirectory.empty() || Glib::path_is_absolute(s->lensfunDbDirectory)) {
LFDatabase::init(s->lensfunDbDirectory);
ok = LFDatabase::init(s->lensfunDbDirectory);
} else {
LFDatabase::init(Glib::build_filename(baseDir, s->lensfunDbDirectory));
ok = LFDatabase::init(Glib::build_filename(baseDir, s->lensfunDbDirectory));
}
if (!ok && !s->lensfunDbBundleDirectory.empty() && s->lensfunDbBundleDirectory != s->lensfunDbDirectory) {
if (Glib::path_is_absolute(s->lensfunDbBundleDirectory)) {
LFDatabase::init(s->lensfunDbBundleDirectory);
} else {
LFDatabase::init(Glib::build_filename(baseDir, s->lensfunDbBundleDirectory));
}
}
}
#ifdef _OPENMP

View File

@ -83,6 +83,7 @@ public:
double level0_cbdl;
double level123_cbdl;
Glib::ustring lensfunDbDirectory; // The directory containing the lensfun database. If empty, the system defaults will be used, as described in https://lensfun.github.io/manual/latest/dbsearch.html
Glib::ustring lensfunDbBundleDirectory;
int cropsleep;
double reduchigh;
double reduclow;

View File

@ -148,12 +148,14 @@ int main (int argc, char **argv)
}
options.rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH;
options.rtSettings.lensfunDbBundleDirectory = LENSFUN_DB_PATH;
#else
argv0 = DATA_SEARCH_PATH;
creditsPath = CREDITS_SEARCH_PATH;
licensePath = LICENCE_SEARCH_PATH;
options.rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH;
options.rtSettings.lensfunDbBundleDirectory = LENSFUN_DB_PATH;
#endif
bool quickstart = dontLoadCache (argc, argv);

View File

@ -425,12 +425,14 @@ int main (int argc, char **argv)
}
options.rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH;
options.rtSettings.lensfunDbBundleDirectory = LENSFUN_DB_PATH;
#else
argv0 = DATA_SEARCH_PATH;
creditsPath = CREDITS_SEARCH_PATH;
licensePath = LICENCE_SEARCH_PATH;
options.rtSettings.lensfunDbDirectory = LENSFUN_DB_PATH;
options.rtSettings.lensfunDbBundleDirectory = LENSFUN_DB_PATH;
#endif
#ifdef WIN32