diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-16 23:06:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-16 23:06:38 +0400 |
commit | 9d05ccf9e84510ca7e3fe140f6e20991a931b8ce (patch) | |
tree | f8f7241b779c9049d853a5e824db2dd150228ebe /release/scripts/modules | |
parent | 707fcc42a390e91aedd858588c30d04fea43f0e6 (diff) | |
parent | 1af839081b7adcc3ceb13e5e7cc579b309e90915 (diff) |
svn merge -r41899:41926 ^/trunk/blender. also sync mempool with trunk and move BLI_mempool_alloc out of mempools header where it was inlined
Diffstat (limited to 'release/scripts/modules')
-rw-r--r-- | release/scripts/modules/bpy/path.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index e6d0fbb99a2..4173d71b39c 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -154,25 +154,23 @@ def resolve_ncase(path): returning a string with the path if found else return the original path. """ - import os - def _ncase_path_found(path): - if not path or os.path.exists(path): + if not path or _os.path.exists(path): return path, True # filename may be a directory or a file - filename = os.path.basename(path) - dirpath = os.path.dirname(path) + filename = _os.path.basename(path) + dirpath = _os.path.dirname(path) suffix = path[:0] # "" but ensure byte/str match if not filename: # dir ends with a slash? if len(dirpath) < len(path): suffix = path[:len(path) - len(dirpath)] - filename = os.path.basename(dirpath) - dirpath = os.path.dirname(dirpath) + filename = _os.path.basename(dirpath) + dirpath = _os.path.dirname(dirpath) - if not os.path.exists(dirpath): + if not _os.path.exists(dirpath): if dirpath == path: return path, False @@ -184,8 +182,8 @@ def resolve_ncase(path): # at this point, the directory exists but not the file # we are expecting 'dirpath' to be a directory, but it could be a file - if os.path.isdir(dirpath): - files = os.listdir(dirpath) + if _os.path.isdir(dirpath): + files = _os.listdir(dirpath) else: return path, False @@ -198,7 +196,7 @@ def resolve_ncase(path): break if f_iter_nocase: - return os.path.join(dirpath, f_iter_nocase) + suffix, True + return _os.path.join(dirpath, f_iter_nocase) + suffix, True else: # cant find the right one, just return the path as is. return path, False @@ -216,8 +214,7 @@ def ensure_ext(filepath, ext, case_sensitive=False): :arg case_sensitive: Check for matching case when comparing extensions. :type case_sensitive: bool """ - import os - fn_base, fn_ext = os.path.splitext(filepath) + fn_base, fn_ext = _os.path.splitext(filepath) if fn_base and fn_ext: if ((case_sensitive and ext == fn_ext) or (ext.lower() == fn_ext.lower())): |