From c16c86bcc01dff2a984aeffd58e2402a876cc12d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 24 Jul 2018 02:27:48 +0200 Subject: make: handle empty prefixes properly still needs to add integration tests --- src/blogc-make/ctx.c | 5 +++-- 1 file changed, 3 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 0a3f9a0..0c47c12 100644 --- a/src/blogc-make/ctx.c +++ b/src/blogc-make/ctx.c @@ -234,12 +234,13 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0, const char *content_dir = bc_trie_lookup(settings->settings, "content_dir"); const char *post_prefix = bc_trie_lookup(settings->settings, "post_prefix"); const char *source_ext = bc_trie_lookup(settings->settings, "source_ext"); + const char *slash = post_prefix[0] == '\0' ? "" : "/"; rv->posts_fctx = NULL; if (settings->posts != NULL) { for (size_t i = 0; settings->posts[i] != NULL; i++) { - char *f = bc_strdup_printf("%s/%s/%s%s", content_dir, post_prefix, - settings->posts[i], source_ext); + char *f = bc_strdup_printf("%s%s%s/%s%s", content_dir, slash, + post_prefix, settings->posts[i], source_ext); rv->posts_fctx = bc_slist_append(rv->posts_fctx, bm_filectx_new(rv, f, settings->posts[i], NULL)); free(f); -- cgit v1.2.3-18-g5258