From f5b1d89c9128cff67eb3e6c2053d83ffbdd5a986 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin <sergey.vfx@gmail.com> Date: Thu, 15 Sep 2011 14:00:04 +0000 Subject: [PATCH] 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. --- game_engine_save_as_runtime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py index b2b225212..6b10bf0a1 100644 --- a/game_engine_save_as_runtime.py +++ b/game_engine_save_as_runtime.py @@ -35,6 +35,7 @@ import bpy import os import sys import shutil +import tempfile def CopyPythonLibs(dst, overwrite_lib, report=print): @@ -104,7 +105,8 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls 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 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls # 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') -- GitLab