diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-05-13 20:25:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-05-13 20:27:35 +0300 |
commit | 24e887cd93d5fc11ec50de2e989849d2911a3403 (patch) | |
tree | 191882aad0c535adb6954d16b9510151fa435430 /release | |
parent | 89c6b58ef5beced631beda50fe89a5087c1e8348 (diff) |
Fix script_paths(check_all=True) missing script paths
BLENDER_SYSTEM_SCRIPTS wasn't included in bpy.utils.script_paths()
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bpy/utils/__init__.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py index 986d8b9f45c..5e2769c12d3 100644 --- a/release/scripts/modules/bpy/utils/__init__.py +++ b/release/scripts/modules/bpy/utils/__init__.py @@ -305,15 +305,21 @@ def script_paths(subdir=None, user_pref=True, check_all=False): """ scripts = list(_scripts) - if check_all: - # all possible paths - base_paths = tuple(_os.path.join(resource_path(res), "scripts") - for res in ('LOCAL', 'USER', 'SYSTEM')) - else: - # only paths blender uses - base_paths = _bpy_script_paths() + # Only paths Blender uses. + # + # Needed this is needed even when 'check_all' is enabled, + # so the 'BLENDER_SYSTEM_SCRIPTS' environment variable will be used. + base_paths = _bpy_script_paths() - for path in base_paths + (script_path_user(), script_path_pref()): + if check_all: + # All possible paths, no duplicates, keep order. + base_paths = ( + *(path for path in (_os.path.join(resource_path(res), "scripts") + for res in ('LOCAL', 'USER', 'SYSTEM')) if path not in base_paths), + *base_paths, + ) + + for path in (*base_paths, script_path_user(), script_path_pref()): if path: path = _os.path.normpath(path) if path not in scripts and _os.path.isdir(path): |