kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 17ceb32e23f02f20ae30f012530aae0c745e5818
parent 46b7a962bfeb0e70c3032dfac4cbc2c9f4035384
Author: Joris Vink <joris@coders.se>
Date:   Fri, 17 Sep 2021 20:23:20 +0200

Cleanup single/dso files properly with kodev clean.

Obey the out_dir too, in case its set differently.

Diffstat:
src/cli.c | 23++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/cli.c b/src/cli.c @@ -748,7 +748,8 @@ cli_source(int argc, char **argv) static void cli_clean(int argc, char **argv) { - char pwd[PATH_MAX], *sofile; + struct buildopt *bopt; + char pwd[PATH_MAX], *bin; if (cli_dir_exists(object_dir)) cli_cleanup_files(object_dir); @@ -757,11 +758,23 @@ cli_clean(int argc, char **argv) fatal("could not get cwd: %s", errno_s); appl = basename(pwd); - (void)cli_vasprintf(&sofile, "%s.so", appl); - if (unlink(sofile) == -1 && errno != ENOENT) - printf("couldn't unlink %s: %s", sofile, errno_s); - free(sofile); + TAILQ_INIT(&mime_types); + TAILQ_INIT(&build_options); + + cli_flavor_load(); + bopt = cli_buildopt_new("_default"); + cli_buildopt_parse("conf/build.conf"); + + if (bopt->single_binary) + (void)cli_vasprintf(&bin, "%s/%s", out_dir, appl); + else + (void)cli_vasprintf(&bin, "%s/%s.so", out_dir, appl); + + if (unlink(bin) == -1 && errno != ENOENT) + printf("couldn't unlink %s: %s", bin, errno_s); + + free(bin); } static void