MCPcopy Create free account
hub / github.com/ElementsProject/lightning / find_my_pkglibexec_path

Function find_my_pkglibexec_path

lightningd/lightningd.c:472–496  ·  view source on GitHub ↗

~ This returns the PKGLIBEXEC path which is where binaries get installed. * Note the `TAKES` annotation which indicates that the `my_path` parameter * can be take(); in which case, this function will handle freeing it. * * TAKES is only a convention unfortunately, and ignored by the compiler. */

Source from the content-addressed store, hash-verified

470 * TAKES is only a convention unfortunately, and ignored by the compiler.
471 */
472static const char *find_my_pkglibexec_path(struct lightningd *ld,
473 const char *my_path TAKES)
474{
475 const char *pkglibexecdir;
476
477 /*~`path_join` is declared in ccan/path/path.h as:
478 *
479 * char *path_join(const tal_t *ctx,
480 * const char *base TAKES, const char *a TAKES);
481 *
482 * So, as we promised with 'TAKES' in our own declaration, if the
483 * caller has called `take()` the `my_path` parameter, path_join()
484 * will free it. */
485 pkglibexecdir = path_join(NULL, my_path, BINTOPKGLIBEXECDIR);
486
487 /*~ The plugin dir is in ../libexec/c-lightning/plugins, which (unlike
488 * those given on the command line) does not need to exist. */
489 plugins_set_builtin_plugins_dir(ld->plugins,
490 path_join(tmpctx,
491 pkglibexecdir, "plugins"));
492
493 /*~ Sometimes take() can be more efficient, since the routine can
494 * manipulate the string in place. This is the case here. */
495 return path_simplify(ld, take(pkglibexecdir));
496}
497
498/* Determine the correct daemon dir. */
499static const char *find_daemon_dir(struct lightningd *ld, const char *argv0)

Callers 1

find_daemon_dirFunction · 0.85

Calls 3

path_joinFunction · 0.85
path_simplifyFunction · 0.85

Tested by

no test coverage detected