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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-27 10:14:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-27 10:14:35 +0400
commitb5b89b5de47c27f4b25165c499c2d25ab6aa1c3c (patch)
tree22b070a00ad14cab844922fc15f6b4446ee04ba5 /game_engine_save_as_runtime.py
parent3b5ab077208996850268798ac9c76421bf2fa908 (diff)
fix for copying python files when python is not found (prints a warning).
initialize the filepath in the invoke function rather then the menu.
Diffstat (limited to 'game_engine_save_as_runtime.py')
-rw-r--r--game_engine_save_as_runtime.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py
index 36916902..f55e2f6d 100644
--- a/game_engine_save_as_runtime.py
+++ b/game_engine_save_as_runtime.py
@@ -135,13 +135,16 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls
src = os.path.join(blender_dir, py_folder)
dst = os.path.join(runtime_dir, py_folder)
- if os.path.exists(dst):
- if overwrite_lib:
- shutil.rmtree(dst)
+ if os.path.exists(src):
+ if os.path.exists(dst):
+ if overwrite_lib:
+ shutil.rmtree(dst)
+ shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__'])
+ else:
shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__'])
else:
- shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__'])
-
+ print("Python not found in %r, skipping pythn copy." % src)
+
print("done")
# And DLLs
@@ -193,17 +196,19 @@ class SaveAsRuntime(bpy.types.Operator):
self.copy_dlls)
print("Finished in %.4fs" % (time.clock()-start_time))
return {'FINISHED'}
-
+
def invoke(self, context, event):
+ if not self.filepath:
+ ext = '.app' if sys.platform == 'darwin' else os.path.splitext(bpy.app.binary_path)[-1]
+ self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ext)
+
wm = context.window_manager
wm.fileselect_add(self)
return {'RUNNING_MODAL'}
def menu_func(self, context):
- ext = '.app' if sys.platform == 'darwin' else os.path.splitext(bpy.app.binary_path)[-1]
- default_blend_path = bpy.path.ensure_ext(bpy.data.filepath, ext)
- self.layout.operator(SaveAsRuntime.bl_idname, text=SaveAsRuntime.bl_label).filepath = default_blend_path
+ self.layout.operator(SaveAsRuntime.bl_idname)
def register():