MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / init_plugins

Method init_plugins

Suscan/Library.cpp:479–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477}
478
479void
480Singleton::init_plugins(void)
481{
482 Plugin *defPlug = Plugin::getDefaultPlugin();
483 QStringList plugins;
484
485 if (!defPlug->load())
486 throw Exception(
487 "Failed to load the default plugin. "
488 "Please report this error to "
489 "<a href=\"https://github.com/BatchDrake/SigDigger/issues\">"
490 "https://github.com/BatchDrake/SigDigger/issues"
491 "</a>");
492
493 plugins << suscan_confdb_get_local_path() + QString("/../plugins")
494 << suscan_confdb_get_system_path() + QString("/../plugins");
495
496 for (auto path : plugins) {
497 QDir dir(path);
498 QStringList files = dir.entryList(QStringList() << "*", QDir::Files);
499 auto asStd = path.toStdString();
500
501 for (auto file : files) {
502 auto fullPath = (path + "/" + file).toStdString();
503 auto plugin = Suscan::Plugin::make(fullPath.c_str());
504
505 if (plugin != nullptr) {
506 if (!plugin->load()) {
507 SU_WARNING("Plugin %s failed to load\n", fullPath.c_str());
508 delete plugin;
509 }
510
511 // TODO: register plugin here!!
512 } else {
513 printf("Failed to make plugin.\n");
514 }
515 }
516 }
517}
518
519void
520Singleton::refreshDevices(void)

Callers 1

ApplicationMethod · 0.80

Calls 2

ExceptionClass · 0.85
loadMethod · 0.45

Tested by

no test coverage detected