summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-18 10:09:58 +0100
committerGitHub <noreply@github.com>2019-02-18 10:09:58 +0100
commitf5f2b5d4af47b51cd1ff887ea2fbd1c3f8aa1eed (patch)
tree8e4b6f4de9e3597c60d00ca0209b3d589f9e697d
parent03c4e4bba8ea5f8c756ba9005f20a67fea5dda13 (diff)
parent2d0fcd5c4a1ccc4edcb56fa04ef690aa829cea4c (diff)
Merge pull request #25962 from willnationsdev/fix-missing-addon
Auto-cleanup missing addons
-rw-r--r--editor/editor_node.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 18858ae2aa..973b2cc7a2 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2579,6 +2579,20 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
Ref<ConfigFile> cf;
cf.instance();
String addon_path = "res://addons/" + p_addon + "/plugin.cfg";
+ if (!DirAccess::exists(addon_path.get_base_dir())) {
+ ProjectSettings *ps = ProjectSettings::get_singleton();
+ PoolStringArray enabled_plugins = ps->get("editor_plugins/enabled");
+ for (int i = 0; i < enabled_plugins.size(); ++i) {
+ if (enabled_plugins.get(i) == p_addon) {
+ enabled_plugins.remove(i);
+ break;
+ }
+ }
+ ps->set("editor_plugins/enabled", enabled_plugins);
+ ps->save();
+ WARN_PRINTS("Addon '" + p_addon + "' failed to load. No directory found. Removing from enabled plugins.");
+ return;
+ }
Error err = cf->load(addon_path);
if (err != OK) {
show_warning(vformat(TTR("Unable to enable addon plugin at: '%s' parsing of config failed."), addon_path));