Now we can run scripts from a .zip.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4206 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-03-08 23:59:11 +00:00
parent 50e48af7c4
commit 63dcab30c3
4 changed files with 78 additions and 14 deletions

View File

@ -324,6 +324,7 @@ typedef struct tf_run_args_t {
const char* db_path;
int count;
const char* args;
const char* zip;
bool help;
} tf_run_args_t;
@ -339,6 +340,7 @@ static int _tf_run_task(const tf_run_args_t* args, int index)
int result = -1;
tf_task_t* task = tf_task_create();
tf_task_set_trusted(task, true);
tf_task_set_zip_path(task, args->zip);
tf_task_set_ssb_port(task, args->ssb_port ? args->ssb_port + index : 0);
tf_task_set_http_port(task, args->http_port ? args->http_port + index : 0);
tf_task_set_https_port(task, args->https_port ? args->https_port + index : 0);
@ -382,6 +384,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
{ "db-path", 'd', offsetof(tf_run_args_t, db_path), NULL, XOPT_TYPE_STRING, NULL, "Sqlite database path (default: db.sqlite)." },
{ "count", 'n', offsetof(tf_run_args_t, count), NULL, XOPT_TYPE_INT, NULL, "Number of instances to run." },
{ "args", 'a', offsetof(tf_run_args_t, args), NULL, XOPT_TYPE_STRING, NULL, "Arguments of the form key=value,foo=bar,verbose=true." },
{ "zip", 'z', offsetof(tf_run_args_t, zip), NULL, XOPT_TYPE_STRING, NULL, "Zip archive from which to load files." },
{ "help", 'h', offsetof(tf_run_args_t, help), NULL, XOPT_TYPE_BOOL, NULL, "Shows this help message." },
XOPT_NULLOPTION,
};
@ -737,7 +740,7 @@ done:
static void _tf_android_thread(void* user_data)
{
char* args[] = { "tildefriends" };
char* args[] = { "tildefriends", "run" };
main(_countof(args), args);
}