lensfun: added possibility to use a private copy of the LF database

This commit is contained in:
Alberto Griggio
2017-09-14 11:34:41 +02:00
parent 5b3d60bf56
commit 008f280e29
7 changed files with 40 additions and 4 deletions

View File

@@ -253,10 +253,27 @@ bool LFLens::hasDistortionCorrection() const
LFDatabase LFDatabase::instance_;
bool LFDatabase::init()
bool LFDatabase::init(const Glib::ustring &dbdir)
{
instance_.data_ = lfDatabase::Create();
return instance_.data_->Load() != LF_NO_ERROR;
if (settings->verbose) {
std::cout << "Loading lensfun database from ";
if (dbdir.empty()) {
std::cout << "the default directories";
} else {
std::cout << "'" << dbdir << "'";
}
std::cout << "..." << std::flush;
}
bool ok = instance_.data_->Load(dbdir.empty() ? nullptr : dbdir.c_str()) == LF_NO_ERROR;
if (settings->verbose) {
std::cout << (ok ? "OK" : "FAIL") << std::endl;
}
return ok;
}