Merge pull request #31810 from merumelu/plugin-config-warnings

Warn about all missing keys in plugin.cfg
This commit is contained in:
Rémi Verschelde 2019-08-31 22:08:57 +02:00 committed by GitHub
commit 61eeace972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 49 additions and 35 deletions

View File

@ -96,18 +96,31 @@ void EditorPluginSettings::update_plugins() {
if (err2 != OK) {
WARN_PRINTS("Can't load plugin config: " + path);
} else if (!cf->has_section_key("plugin", "name")) {
WARN_PRINTS("Plugin misses plugin/name: " + path);
} else if (!cf->has_section_key("plugin", "author")) {
WARN_PRINTS("Plugin misses plugin/author: " + path);
} else if (!cf->has_section_key("plugin", "version")) {
WARN_PRINTS("Plugin misses plugin/version: " + path);
} else if (!cf->has_section_key("plugin", "description")) {
WARN_PRINTS("Plugin misses plugin/description: " + path);
} else if (!cf->has_section_key("plugin", "script")) {
WARN_PRINTS("Plugin misses plugin/script: " + path);
} else {
bool key_missing = false;
if (!cf->has_section_key("plugin", "name")) {
WARN_PRINTS("Plugin config misses \"plugin/name\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "author")) {
WARN_PRINTS("Plugin config misses \"plugin/author\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "version")) {
WARN_PRINTS("Plugin config misses \"plugin/version\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "description")) {
WARN_PRINTS("Plugin config misses \"plugin/description\" key: " + path);
key_missing = true;
}
if (!cf->has_section_key("plugin", "script")) {
WARN_PRINTS("Plugin config misses \"plugin/script\" key: " + path);
key_missing = true;
}
if (!key_missing) {
String d2 = plugins[i];
String name = cf->get_value("plugin", "name");
String author = cf->get_value("plugin", "author");
@ -117,7 +130,7 @@ void EditorPluginSettings::update_plugins() {
TreeItem *item = plugin_list->create_item(root);
item->set_text(0, name);
item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script + "\nDescription: " + description);
item->set_tooltip(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + script + "\n" + TTR("Description:") + " " + description);
item->set_metadata(0, d2);
item->set_text(1, version);
item->set_metadata(1, script);
@ -138,6 +151,7 @@ void EditorPluginSettings::update_plugins() {
}
}
}
}
updating = false;
}