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

Function find_my_directory

lightningd/lightningd.c:526–545  ·  view source on GitHub ↗

Returns the directory this executable is running from */

Source from the content-addressed store, hash-verified

524
525/* Returns the directory this executable is running from */
526static const char *find_my_directory(const tal_t *ctx, const char *argv0)
527{
528 /* find_my_abspath simply exits on failure, so never returns NULL. */
529 const char *me = find_my_abspath(NULL, argv0);
530
531 /*~ The caller just wants the directory we're in.
532 *
533 * Note the magic `take()` macro here: it annotates a pointer as "to
534 * be taken", and the recipient is expected to take ownership of the
535 * pointer. This improves efficiency because the recipient might
536 * choose to use or even keep it rather than make a copy (or it
537 * might just free it).
538 *
539 * Many CCAN and our own routines support this, but if you hand a
540 * `take()` to a routine which *doesn't* expect it, unfortunately you
541 * don't get a compile error (we have runtime detection for this
542 * case, however).
543 */
544 return path_dirname(ctx, take(me));
545}
546
547/* How to get from abspath dir1 to abspath dir2? */
548static const char *relative(const tal_t *ctx, const char *dir1, const char *dir2)

Callers 1

Calls 2

find_my_abspathFunction · 0.85
path_dirnameFunction · 0.85

Tested by

no test coverage detected