Allow exporting from a non-default db location. I'm running over NFS on this instance.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3789 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
0a580b60b1
commit
d0c89991be
13
src/main.c
13
src/main.c
@ -238,10 +238,12 @@ xopt_help:
|
||||
static int _tf_command_export(const char* file, int argc, char* argv[])
|
||||
{
|
||||
typedef struct args_t {
|
||||
const char* db_path;
|
||||
bool help;
|
||||
} args_t;
|
||||
|
||||
xoptOption options[] = {
|
||||
{ "db-path", 'd', offsetof(args_t, db_path), NULL, XOPT_TYPE_STRING, NULL, "Sqlite database path (default: db.sqlite)." },
|
||||
{ "help", 'h', offsetof(args_t, help), NULL, XOPT_TYPE_BOOL, NULL, "Shows this help message." },
|
||||
XOPT_NULLOPTION,
|
||||
};
|
||||
@ -261,7 +263,12 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, NULL, NULL);
|
||||
sqlite3* db = NULL;
|
||||
if (args.db_path)
|
||||
{
|
||||
sqlite3_open(args.db_path, &db);
|
||||
}
|
||||
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, db, NULL);
|
||||
if (extra_count)
|
||||
{
|
||||
for (int i = 0; i < extra_count; i++)
|
||||
@ -284,6 +291,10 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
tf_ssb_destroy(ssb);
|
||||
if (db)
|
||||
{
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
if (extras)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user