From 0c290f72a9101c196031c3bcf5ee1340b4328b80 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 3 Mar 2017 01:10:35 +0100 Subject: make: reworked binary lookups, added them to ctx --- src/blogc-make/ctx.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/blogc-make/ctx.c') diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c index 7d3489b..62b40b8 100644 --- a/src/blogc-make/ctx.c +++ b/src/blogc-make/ctx.c @@ -16,6 +16,7 @@ #include "../common/utils.h" #include "atom.h" #include "settings.h" +#include "exec.h" #include "ctx.h" @@ -105,7 +106,8 @@ bm_filectx_free(bm_filectx_t *fctx) bm_ctx_t* -bm_ctx_new(bm_ctx_t *base, const char *settings_file, bc_error_t **err) +bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0, + bc_error_t **err) { if (settings_file == NULL || err == NULL || *err != NULL) return NULL; @@ -138,6 +140,9 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, bc_error_t **err) bm_ctx_t *rv = NULL; if (base == NULL) { rv = bc_malloc(sizeof(bm_ctx_t)); + rv->blogc = bm_exec_find_binary(argv0, "blogc", "BLOGC"); + rv->blogc_runserver = bm_exec_find_binary(argv0, "blogc-runserver", + "BLOGC_RUNSERVER"); rv->verbose = false; } else { @@ -224,7 +229,7 @@ bm_ctx_reload(bm_ctx_t *ctx) // needs to dup path, because it may be freed when reloading. char *tmp = bc_strdup(ctx->settings_fctx->path); bc_error_t *err = NULL; - ctx = bm_ctx_new(ctx, tmp, &err); + ctx = bm_ctx_new(ctx, tmp, NULL, &err); free(tmp); if (err != NULL) { // failed to reload, keep old ctx bc_error_print(err, "blogc-make"); @@ -283,5 +288,7 @@ void bm_ctx_free(bm_ctx_t *ctx) { bm_ctx_free_internal(ctx); + free(ctx->blogc); + free(ctx->blogc_runserver); free(ctx); } -- cgit v1.2.3-18-g5258