Fix T44137: bpy.path.is_subdir fails
`bpy.path.is_subdir("/abc/def/ghi","/abc/de")` incorrectly returned True
This commit is contained in:
@@ -116,7 +116,11 @@ def is_subdir(path, directory):
|
|||||||
from os.path import normpath, normcase
|
from os.path import normpath, normcase
|
||||||
path = normpath(normcase(path))
|
path = normpath(normcase(path))
|
||||||
directory = normpath(normcase(directory))
|
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="_"):
|
def clean_name(name, replace="_"):
|
||||||
|
|||||||
Reference in New Issue
Block a user