Fix T69213: App-Template doesn't run scripts in BLENDER_USER_SCRIPTS

This commit is contained in:
Campbell Barton
2020-01-28 14:01:18 +11:00
parent 507a331f01
commit eb6cb67ab6

View File

@@ -409,26 +409,18 @@ def app_template_paths(subdir=None):
:return: app template paths. :return: app template paths.
:rtype: generator :rtype: generator
""" """
# Note: keep in sync with: Blender's BKE_appdir_app_template_any subdir_args = (subdir,) if subdir is not None else ()
# Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'.
subdir_tuple = (subdir,) if subdir is not None else () # Uses 'BLENDER_USER_SCRIPTS', 'BLENDER_SYSTEM_SCRIPTS'
# ... in this case 'system' accounts for 'local' too.
# Avoid adding 'bl_app_templates_system' twice. scripts_system, scripts_user = _bpy_script_paths()
# Either we have a portable build or an installed system build. for resource_fn, module_name in (
for resource_type, module_name in ( (_user_resource, "bl_app_templates_user"),
('USER', "bl_app_templates_user"), (system_resource, "bl_app_templates_system"),
('LOCAL', "bl_app_templates_system"),
('SYSTEM', "bl_app_templates_system"),
): ):
path = resource_path(resource_type) path = resource_fn('SCRIPTS', _os.path.join("startup", module_name, *subdir_args))
if path: if path and _os.path.isdir(path):
path = _os.path.join( yield path
*(path, "scripts", "startup", module_name, *subdir_tuple))
if _os.path.isdir(path):
yield path
# Only load LOCAL or SYSTEM (never both).
if resource_type == 'LOCAL':
break
def preset_paths(subdir): def preset_paths(subdir):