| 339 | #endif /* DEVELOPER */ |
| 340 | |
| 341 | const char *subdaemon_path(const tal_t *ctx, const struct lightningd *ld, const char *name) |
| 342 | { |
| 343 | /* Strip the leading "lightning_" before looking in alt_subdaemons. |
| 344 | */ |
| 345 | size_t pfxlen = strlen("lightning_"); |
| 346 | assert(strlen(name) > pfxlen); |
| 347 | const char *short_name = tal_strdup(ctx, name + pfxlen); |
| 348 | |
| 349 | /* Is there an alternate path for this subdaemon? */ |
| 350 | const char *dpath; |
| 351 | const char *alt = strmap_get(&ld->alt_subdaemons, short_name); |
| 352 | if (alt) { |
| 353 | /* path_join will honor absolute paths as well. */ |
| 354 | dpath = path_join(ctx, ld->daemon_dir, alt); |
| 355 | } else { |
| 356 | /* This subdaemon is found in the standard place. */ |
| 357 | dpath = path_join(ctx, ld->daemon_dir, name); |
| 358 | } |
| 359 | return dpath; |
| 360 | } |
| 361 | |
| 362 | /*~ Check we can run them, and check their versions */ |
| 363 | void test_subdaemons(const struct lightningd *ld) |