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

Function find_my_directory

lightningd/lightningd.c:523–542  ·  view source on GitHub ↗

Returns the directory this executable is running from */

Source from the content-addressed store, hash-verified

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