Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-07-20 19:33:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-07-20 19:33:27 +0400
commit76e91d7a5f8c253543bd1c938c8e74872d7a6c81 (patch)
tree85c9c109e85c7246daafef51f9c1183f4fb67f3c /release
parent4ad43aaf16951ff3b916497509b1499734f38d0b (diff)
fix [#27922] using preset_paths() with an absolute path returns twice the same thing
raise an error when an invalid subdir is passed to preset_paths()
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 7c0d3d24cba..57d3e6dd703 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -298,11 +298,18 @@ _presets = _os.path.join(_scripts[0], "presets") # FIXME - multiple paths
def preset_paths(subdir):
"""
Returns a list of paths for a specific preset.
+
+ :arg subdir: preset subdirectory (must not be an absolute path).
+ :type subdir: string
+ :return: script paths.
+ :rtype: list
"""
dirs = []
for path in script_paths("presets", all=True):
directory = _os.path.join(path, subdir)
- if _os.path.isdir(directory):
+ if not directory.startswith(path):
+ raise Exception("invalid subdir given %r" % subdir)
+ elif _os.path.isdir(directory):
dirs.append(directory)
return dirs