initialise AP_Module, looking for shared libraries in the given module path */
| 80 | initialise AP_Module, looking for shared libraries in the given module path |
| 81 | */ |
| 82 | void AP_Module::init(const char *module_path) |
| 83 | { |
| 84 | #if AP_MODULE_SUPPORTED |
| 85 | // scan through module directory looking for *.so |
| 86 | DIR *d; |
| 87 | struct dirent *de; |
| 88 | d = opendir(module_path); |
| 89 | if (d == nullptr) { |
| 90 | return; |
| 91 | } |
| 92 | while ((de = readdir(d))) { |
| 93 | const char *extension = strrchr(de->d_name, '.'); |
| 94 | if (extension == nullptr || strcmp(extension, ".so") != 0) { |
| 95 | continue; |
| 96 | } |
| 97 | char *path = nullptr; |
| 98 | if (asprintf(&path, "%s/%s", module_path, de->d_name) == -1) { |
| 99 | continue; |
| 100 | } |
| 101 | module_scan(path); |
| 102 | free(path); |
| 103 | } |
| 104 | closedir(d); |
| 105 | #endif |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /* |