Browse Source

Add "disabled" property to module object in manifest.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
5bba5e9a69
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      src/plugin/Plugin.cpp

+ 9
- 0
src/plugin/Plugin.cpp View File

@@ -88,6 +88,14 @@ void Plugin::fromJson(json_t *rootJ) {
size_t moduleId;
json_t *moduleJ;
json_array_foreach(modulesJ, moduleId, moduleJ) {
// Check if module is disabled
json_t *disabledJ = json_object_get(moduleJ, "disabled");
if (disabledJ) {
if (json_boolean_value(disabledJ))
continue;
}

// Get model slug
json_t *modelSlugJ = json_object_get(moduleJ, "slug");
if (!modelSlugJ) {
throw UserException(string::f("No slug found for module entry %d", moduleId));
@@ -99,6 +107,7 @@ void Plugin::fromJson(json_t *rootJ) {
throw UserException(string::f("Module slug \"%s\" is invalid", modelSlug.c_str()));
}

// Get model
Model *model = getModel(modelSlug);
if (!model) {
throw UserException(string::f("Manifest contains module %s but it is not defined in the plugin", modelSlug.c_str()));


Loading…
Cancel
Save