[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2327] trunk/py/scripts/addons/ game_engine_save_as_runtime.py: Fix #28555: Save as Runtime addon not working in 2.59

Sergey Sharybin g.ulairi at gmail.com
Thu Sep 15 16:00:05 CEST 2011


Revision: 2327
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2327
Author:   nazgul
Date:     2011-09-15 14:00:04 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
Fix #28555: Save as Runtime addon not working in 2.59

Temporary mainfile used to be saved to current working directory
which isn't always available for writting.
Save temporary mainfile to temporary directory.

Modified Paths:
--------------
    trunk/py/scripts/addons/game_engine_save_as_runtime.py

Modified: trunk/py/scripts/addons/game_engine_save_as_runtime.py
===================================================================
--- trunk/py/scripts/addons/game_engine_save_as_runtime.py	2011-09-14 10:56:28 UTC (rev 2326)
+++ trunk/py/scripts/addons/game_engine_save_as_runtime.py	2011-09-15 14:00:04 UTC (rev 2327)
@@ -35,6 +35,7 @@
 import os
 import sys
 import shutil
+import tempfile
 
 
 def CopyPythonLibs(dst, overwrite_lib, report=print):
@@ -104,7 +105,8 @@
     file.close()
     
     # Create a tmp blend file (Blenderplayer doesn't like compressed blends)
-    blend_path = bpy.path.clean_name(output_path)
+    tempdir = tempfile.mkdtemp()
+    blend_path = os.path.join(tempdir, bpy.path.clean_name(output_path))
     bpy.ops.wm.save_as_mainfile(filepath=blend_path,
                                 relative_remap=False,
                                 compress=False,
@@ -119,6 +121,7 @@
 
     # Get rid of the tmp blend, we're done with it
     os.remove(blend_path)
+    os.rmdir(tempdir)
     
     # Create a new file for the bundled runtime
     output = open(output_path, 'wb')



More information about the Bf-extensions-cvs mailing list