In ART (and RT) windows builds, the Lensfun DB is located in share/lensfun. There is no version_2 subdir.
so I modified dbupdate.cpp as follows:
#include
#include “lensfun_dbupdate.h”
//print error and exit:
void err(std::string msg)
{
printf(“Error: %s\n”,msg.c_str());
exit(0);
}
int main(int argc, char ** argv)
{
int dbversion = 1;
if (argc >= 2) dbversion = atoi(argv[1]);
switch (lensfun_dbupdate(2, “share/lensfun”)) {
case LENSFUN_DBUPDATE_OK: std::cout << “database updated” << std::endl; break;
case LENSFUN_DBUPDATE_NOVERSION: std::cout << “no version available” << std::endl; break;
case LENSFUN_DBUPDATE_CURRENTVERSION: std::cout << “local database is latest” << std::endl; break;
case LENSFUN_DBUPDATE_RETRIEVFAIL: std::cout << “database retrieve failed” << std::endl; break;
}
}
as I don't want to transmit arguments to the exe.
, I
With above program, a ./share/lensfun/version_2
subdir is added and updated, so it fails to update ./share/lensfun
.
What I hope:
- the database is fetched and updated in ./share/lensfun and not ./share/lensfun/version_2
- a plus should be that the version of DB be automatically identified.
edit with this hack, I think I can get what I want (still to test thouroughly).
Bug: the timestamp is updated but not the xml files
diff --git a/dbupdate.cpp b/dbupdate.cpp
index 55e9278..f3d3e6b 100644
--- a/dbupdate.cpp
+++ b/dbupdate.cpp
@@ -15,7 +15,7 @@ int main(int argc, char ** argv)
int dbversion = 1;
if (argc >= 2) dbversion = atoi(argv[1]);
- switch (lensfun_dbupdate(dbversion)) {
+ switch (lensfun_dbupdate(2, "share/lensfun")) {
case LENSFUN_DBUPDATE_OK: std::cout << "database updated" << std::endl; break;
case LENSFUN_DBUPDATE_NOVERSION: std::cout << "no version available" << std::endl; break;
case LENSFUN_DBUPDATE_CURRENTVERSION: std::cout << "local database is latest" << std::endl; break;
diff --git a/lensfun_dbupdate.cpp b/lensfun_dbupdate.cpp
index 17c9900..3c712ce 100644
--- a/lensfun_dbupdate.cpp
+++ b/lensfun_dbupdate.cpp
@@ -348,8 +348,8 @@ lf_db_return lensfun_dbupdate(int version, std::string dbpath)
const std::string repositoryurl = "http://lensfun.sourceforge.net/db/";
//build the dir to store the lensfun database:
- std::string dbdir = string_format("version_%d",dbversion);
-
+// std::string dbdir = string_format("version_%d",dbversion);
+ std::string dbdir = string_format("",dbversion);
//get versions.json:
std::string versions = getAsString(string_format("%sversions.json",repositoryurl.c_str()));