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
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