MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / init

Method init

libraries/AP_Module/AP_Module.cpp:82–106  ·  view source on GitHub ↗

initialise AP_Module, looking for shared libraries in the given module path */

Source from the content-addressed store, hash-verified

80 initialise AP_Module, looking for shared libraries in the given module path
81*/
82void 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/*

Callers 1

setupFunction · 0.45

Calls 3

strcmpFunction · 0.85
asprintfFunction · 0.85
freeFunction · 0.85

Tested by 1

setupFunction · 0.36