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

Function find_my_directory

lightningd/lightningd.c:445–464  ·  view source on GitHub ↗

Returns the directory this executable is running from */

Source from the content-addressed store, hash-verified

443
444/* Returns the directory this executable is running from */
445static const char *find_my_directory(const tal_t *ctx, const char *argv0)
446{
447 /* find_my_abspath simply exits on failure, so never returns NULL. */
448 const char *me = find_my_abspath(NULL, argv0);
449
450 /*~ The caller just wants the directory we're in.
451 *
452 * Note the magic `take()` macro here: it annotates a pointer as "to
453 * be taken", and the recipient is expected to take ownership of the
454 * pointer. This improves efficiency because the recipient might
455 * choose to use or even keep it rather than make a copy (or it
456 * might just free it).
457 *
458 * Many CCAN and our own routines support this, but if you hand a
459 * `take()` to a routine which *doesn't* expect it, unfortunately you
460 * don't get a compile error (we have runtime detection for this
461 * case, however).
462 */
463 return path_dirname(ctx, take(me));
464}
465
466/*~ This returns the PKGLIBEXEC path which is where binaries get installed.
467 * Note the `TAKES` annotation which indicates that the `my_path` parameter

Callers 1

find_daemon_dirFunction · 0.85

Calls 2

find_my_abspathFunction · 0.85
path_dirnameFunction · 0.85

Tested by

no test coverage detected