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>2015-03-26 08:29:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-03-26 08:32:16 +0300
commitb87eaef1f7928bd6f0e937474cf922afa4c07f83 (patch)
treedc73838e12d499572bbe3794adea9a194f7a725d /release/scripts/modules/bpy/path.py
parent770b109deb6fbaea571901e56f5b9b6742483f69 (diff)
Fix T44137: bpy.path.is_subdir fails
`bpy.path.is_subdir("/abc/def/ghi","/abc/de")` incorrectly returned True
Diffstat (limited to 'release/scripts/modules/bpy/path.py')
-rw-r--r--release/scripts/modules/bpy/path.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index 25a6c7242e0..0012083ba98 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -116,7 +116,11 @@ def is_subdir(path, directory):
from os.path import normpath, normcase
path = normpath(normcase(path))
directory = normpath(normcase(directory))
- return path.startswith(directory)
+ if len(path) > len(directory):
+ if path.startswith(directory):
+ sep = ord(_os.sep) if isinstance(directory, bytes) else _os.sep
+ return (path[len(directory)] == sep)
+ return False
def clean_name(name, replace="_"):