PyAPI: tweak to ensure_ext don't lower entire path

This commit is contained in:
Campbell Barton 2015-09-03 21:58:11 +10:00
parent 8383a2d4cc
commit 73b34ad06b

@ -290,9 +290,12 @@ def ensure_ext(filepath, ext, case_sensitive=False):
:type case_sensitive: bool :type case_sensitive: bool
""" """
if ((case_sensitive and filepath.endswith(ext)) or if case_sensitive:
(not case_sensitive and filepath.lower().endswith(ext.lower()))): if filepath.endswith(ext):
return filepath return filepath
else:
if filepath[-len(ext):].lower().endswith(ext.lower()):
return filepath
return filepath + ext return filepath + ext