From 744819cf9b58fa5502b51b218efe37428ca3a4d9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 May 2024 15:01:57 +1000 Subject: [PATCH] Addons: only ever check "addons_core" for bundled add-ons Avoid checking every scripts directory for add-ons core, as creating this directory would cause "addons" to be ignored. --- scripts/modules/addon_utils.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/modules/addon_utils.py b/scripts/modules/addon_utils.py index 7339f0582b4..c1f3df57c11 100644 --- a/scripts/modules/addon_utils.py +++ b/scripts/modules/addon_utils.py @@ -40,18 +40,14 @@ def paths(): import os paths = [] - for p in _bpy.utils.script_paths(): - # Bundled add-ons. - addon_dir = os.path.join(p, "addons_core") - if os.path.isdir(addon_dir): - paths.append(addon_dir) - # The system path if for core add-ons only, - # if the `addons` directory exists it's likely from an old "make install" target. - continue - # User defined add-ons, custom scripts directory. - addon_dir = os.path.join(p, "addons") + for i, p in enumerate(_bpy.utils.script_paths()): + # Bundled add-ons are always first. + # Since this isn't officially part of the API, print an error so this never silently fails. + addon_dir = os.path.join(p, "addons_core" if i == 0 else "addons") if os.path.isdir(addon_dir): paths.append(addon_dir) + elif i == 0: + print("Internal error:", addon_dir, "was not found!") return paths