diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-25 16:39:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-25 16:39:53 +0400 |
commit | 70d059161b81993a154d8e7c65ed940739791687 (patch) | |
tree | 606d0fa3d09bff242a55834ad42900e42fa5f6a9 /source/blender/collada/collada.cpp | |
parent | 739359faabc6ea20b107b5ec694b715e2b5ad800 (diff) |
workaround/fix [#27162] Running commands in python console crashes blender
Diffstat (limited to 'source/blender/collada/collada.cpp')
-rw-r--r-- | source/blender/collada/collada.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 0d822c63094..51caf62f6e7 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -38,6 +38,11 @@ extern "C" #include "BKE_scene.h" #include "BKE_context.h" +/* make dummy file */ +#include "BLI_storage.h" +#include "BLI_path_util.h" +#include "BLI_fileops.h" + int collada_import(bContext *C, const char *filepath) { DocumentImporter imp (C, filepath); @@ -48,8 +53,17 @@ extern "C" int collada_export(Scene *sce, const char *filepath) { - DocumentExporter exp; + + /* annoying, collada crashes if file cant be created! [#27162] */ + if(!BLI_exist(filepath)) { + BLI_make_existing_file(filepath); /* makes the dir if its not there */ + if(BLI_touch(filepath) == 0) { + return 0; + } + } + /* end! */ + exp.exportCurrentScene(sce, filepath); return 1; |