diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-12 18:58:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-12 18:58:53 +0300 |
commit | aa523f8435d209559749bbafeee82ad964726a0f (patch) | |
tree | bf1ded431675f7f0e68311128225a199d54c6f96 /release/scripts/modules | |
parent | 7142bf6cf3beef26f0f67582010e44a829754142 (diff) |
Fix os.path.is_subdir w/ trailing slash
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bpy/path.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index d7c6101115d..db4c8da30f0 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -118,13 +118,13 @@ def is_subdir(path, directory): :arg path: An absolute path. :type path: string or bytes """ - from os.path import normpath, normcase + from os.path import normpath, normcase, sep path = normpath(normcase(path)) directory = normpath(normcase(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) + sep = sep.encode('ascii') if isinstance(directory, bytes) else sep + if path.startswith(directory.rstrip(sep) + sep): + return True return False |