Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-01-15 08:33:08 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-01-15 08:33:08 +0400
commita404e3f7804e216d0e179563141a702e7ff802d3 (patch)
treed944cb10d4d75f1d3453f18c6a1e22d8677a747b /release/scripts/modules/bpy_extras/io_utils.py
parent8496a5a501e51f392c91d8736b22817d7c34703d (diff)
fix issue reported in '[#33876] bpy.path.ensure_ext adds extension twice / extra period if filename empty, just a period or equal to extension'
For python operators that used the ExportHelper mix-in class, an empty file field would become '.ext', entering and existing the text field would become '.ext.ext', Now only add an extension if the filename part of the path is set, so '.ext' will still become '.ext.ext' but having only the extension isn't so likely to happen in the first place now. This is a different fix then the changes suggested in the report but I'd prefer to keep path functions stupid+predictable.
Diffstat (limited to 'release/scripts/modules/bpy_extras/io_utils.py')
-rw-r--r--release/scripts/modules/bpy_extras/io_utils.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 4457ecb43e6..0e9b6c136e9 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -79,20 +79,23 @@ class ExportHelper:
return {'RUNNING_MODAL'}
def check(self, context):
+ import os
change_ext = False
change_axis = _check_axis_conversion(self)
check_extension = self.check_extension
if check_extension is not None:
- filepath = bpy.path.ensure_ext(self.filepath,
- self.filename_ext
- if check_extension
- else "")
-
- if filepath != self.filepath:
- self.filepath = filepath
- change_ext = True
+ filepath = self.filepath
+ if os.path.basename(filepath):
+ filepath = bpy.path.ensure_ext(filepath,
+ self.filename_ext
+ if check_extension
+ else "")
+
+ if filepath != self.filepath:
+ self.filepath = filepath
+ change_ext = True
return (change_ext or change_axis)