[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31020] trunk/blender/release/scripts/op/ image.py: exit image externally wasnt checking if the image existed first.

Campbell Barton ideasman42 at gmail.com
Wed Aug 4 01:02:18 CEST 2010


Revision: 31020
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31020
Author:   campbellbarton
Date:     2010-08-04 01:02:18 +0200 (Wed, 04 Aug 2010)

Log Message:
-----------
exit image externally wasnt checking if the image existed first.

Modified Paths:
--------------
    trunk/blender/release/scripts/op/image.py

Modified: trunk/blender/release/scripts/op/image.py
===================================================================
--- trunk/blender/release/scripts/op/image.py	2010-08-03 22:44:15 UTC (rev 31019)
+++ trunk/blender/release/scripts/op/image.py	2010-08-03 23:02:18 UTC (rev 31020)
@@ -56,14 +56,16 @@
         return image_editor
 
     def execute(self, context):
+        import os
         import subprocess
-        filepath = self.properties.filepath
-        image_editor = self._editor_guess(context)
+        filepath = bpy.utils.expandpath(self.properties.filepath)
 
-        cmd = []
-        cmd.extend(image_editor)
-        cmd.append(bpy.utils.expandpath(filepath))
+        if not os.path.exists(filepath):
+            self.report('ERROR', "Image path '%s' not found." % filepath)
+            return {'CANCELLED'}
 
+        cmd = self._editor_guess(context) + [filepath]
+
         subprocess.Popen(cmd)
 
         return {'FINISHED'}





More information about the Bf-blender-cvs mailing list