diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-15 18:00:04 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-15 18:00:04 +0400 |
commit | f5b1d89c9128cff67eb3e6c2053d83ffbdd5a986 (patch) | |
tree | 2f6b5c4ebf8259adbbbd760ec68cb14db2c77029 /game_engine_save_as_runtime.py | |
parent | ce44098a23c783bd0822ca948bf1018aacf07921 (diff) |
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.
Diffstat (limited to 'game_engine_save_as_runtime.py')
-rw-r--r-- | game_engine_save_as_runtime.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py index b2b22521..6b10bf0a 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') |