From 9164be2f37018c455c001acbc7b42f9320641646 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 25 Mar 2024 16:34:27 -0400 Subject: [PATCH] Fix loading from not standalone zip. --- src/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index f82d7a67..958bfed9 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,7 @@ #include "backtrace.h" #include "sqlite3.h" +#include "unzip.h" #include #include @@ -412,11 +413,18 @@ static int _tf_command_run(const char* file, int argc, char* argv[]) .http_port = 12345, .https_port = 12346, .ssb_port = 8008, - .zip = file, .db_path = k_db_path_default, }; bool show_usage = false; + /* Check if the executable has data attached. */ + unzFile zip = unzOpen(file); + if (zip) + { + args.zip = file; + unzClose(zip); + } + while (!show_usage) { static const struct option k_options[] = {