From 7002139fadef7c63f1198398bc03cfc7a868a1ae Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 28 Nov 2020 11:31:31 +0100 Subject: [PATCH] Add self-test to module manager for those who rm -rf their source directory. --- src/modulemanager.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/modulemanager.c b/src/modulemanager.c index 6012bda5b..854f2a038 100644 --- a/src/modulemanager.c +++ b/src/modulemanager.c @@ -1643,11 +1643,33 @@ void mm_parse_c_file(int argc, char *args[]) exit(0); } +void mm_self_test(void) +{ + char name[512]; + snprintf(name, sizeof(name), "%s/src/modules/third", BUILDDIR); + if (file_exists(name)) + return; + if (!file_exists(BUILDDIR)) + { + fprintf(stderr, "ERROR: Directory %s does not exist.\n" + "The UnrealIRCd source is required for the module manager to work!\n", + BUILDDIR); + } else { + fprintf(stderr, "ERROR: Directory %s exists, but %s does not.\n" + "The UnrealIRCd source is required for the module manager to work.\n" + "It seems you only have a partial build directory??\n", + BUILDDIR, name); + } + exit(-1); +} + void modulemanager(int argc, char *args[]) { if (!args[0]) mm_usage(); + mm_self_test(); + /* The following operations do not require reading * of the repository list and are always available: */