[Bf-blender-cvs] [73b34ad] master: PyAPI: tweak to ensure_ext don't lower entire path

Campbell Barton noreply at git.blender.org
Thu Sep 3 14:05:21 CEST 2015


Commit: 73b34ad06b770f1a9b4022ab9863efa80b003ae3
Author: Campbell Barton
Date:   Thu Sep 3 21:58:11 2015 +1000
Branches: master
https://developer.blender.org/rB73b34ad06b770f1a9b4022ab9863efa80b003ae3

PyAPI: tweak to ensure_ext don't lower entire path

===================================================================

M	release/scripts/modules/bpy/path.py

===================================================================

diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index c31188a..d7c6101 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -290,9 +290,12 @@ def ensure_ext(filepath, ext, case_sensitive=False):
     :type case_sensitive: bool
     """
 
-    if ((case_sensitive and filepath.endswith(ext)) or
-            (not case_sensitive and filepath.lower().endswith(ext.lower()))):
-        return filepath
+    if case_sensitive:
+        if filepath.endswith(ext):
+            return filepath
+    else:
+        if filepath[-len(ext):].lower().endswith(ext.lower()):
+            return filepath
 
     return filepath + ext




More information about the Bf-blender-cvs mailing list