aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make/ctx.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-03 01:10:35 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2017-03-03 01:10:35 +0100
commit0c290f72a9101c196031c3bcf5ee1340b4328b80 (patch)
tree4ac5e096ffc79afbd830b6c478646f355e1156b8 /src/blogc-make/ctx.c
parentbe39aad967f2243dd512ae9ab9510179d13abf16 (diff)
downloadblogc-0c290f72a9101c196031c3bcf5ee1340b4328b80.tar.gz
blogc-0c290f72a9101c196031c3bcf5ee1340b4328b80.tar.bz2
blogc-0c290f72a9101c196031c3bcf5ee1340b4328b80.zip
make: reworked binary lookups, added them to ctx
Diffstat (limited to 'src/blogc-make/ctx.c')
-rw-r--r--src/blogc-make/ctx.c11
1 files changed, 9 insertions, 2 deletions
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);
}