From f6c55b3c3f395839c0973c36b7a7e05984636a61 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Tue, 14 Jul 2015 21:45:59 +1000 Subject: Allow frontends to specify the sync database extension This allows frontends to select between the .db and .files databases currently supplied by repo-add or any other compatible database. Signed-off-by: Allan McRae --- lib/libalpm/db.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/db.c') diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index fe208be0..b94d3342 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -375,10 +375,12 @@ const char *_alpm_db_path(alpm_db_t *db) CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); sprintf(db->_path, "%s%s/", dbpath, db->treename); } else { - pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4; + const char *dbext = db->handle->dbext; + + pathsize = strlen(dbpath) + 5 + strlen(db->treename) + strlen(dbext) + 1; CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); /* all sync DBs now reside in the sync/ subdir of the dbpath */ - sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename); + sprintf(db->_path, "%ssync/%s%s", dbpath, db->treename, dbext); } _alpm_log(db->handle, ALPM_LOG_DEBUG, "database path for tree %s set to %s\n", db->treename, db->_path); -- cgit v1.2.3